I am trying to get streaming replication running on postgresql 9.0. I am following the steps as mentioned in the link : http://brandonkonkle.com/blog/2010/oct/20/postgres-9-streaming-replication-and-django-balanc/
When I try to execute an archiving command on postgresql, I get warning asking me to wait endlessly. I am executing the comm开发者_开发问答ands in the following order:
SELECT pg_start_backup('base_backup');
cd /var/lib/postgresql/9.0/
sudo tar -cjf ~/postgres-data.tar.bz2 main
SELECT pg_stop_backup();
For this I get the following output:
NOTICE: pg_stop_backup cleanup done, waiting for required WAL segments to be archived
WARNING: pg_stop_backup still waiting for all required WAL segments to be archived (60 seconds elapsed)
HINT: Check that your archive_command is executing properly. pg_stop_backup can be cancelled safely, but the database backup will not be usable without all the WAL segments.
WARNING: pg_stop_backup still waiting for all required WAL segments to be archived (120 seconds elapsed)
HINT: Check that your archive_command is executing properly. pg_stop_backup can be cancelled safely, but the database backup will not be usable without all the WAL segments.
This keeps continuing further and the warning never ends. Please let me know if anyone has faced this issue.
You have set up an archive_command
as described in the link you specify? Is it actually copying the xlog files to a safe location correctly? The output from the server suggests that it isn't, and that a backlog is building up inside pg_xlog
I seem to remember that you don't actually need archiving enabled on the server to use it as the master in a replica. You do need to have wal_level
set to hot_standby
. With that setting in place, your replica can connect to the master to stream xlog records independently of the traditional xlog archiving process. So try setting archive_mode=off
.
edit: reading the link in more detail, you need to set archive_mode to create the base backup, which makes sense. so either fix the archive command so that you can take the base backup properly, or take a base backup while the server is stopped.
If you just want to use the new SR in pg 9 don't even mess w/ the archiving. I was having issues w/ it at first too. I wrote a barebones setup tutorial w/o archiving that replicates a master to a slave: http://eggie5.com/15-setting-up-pg9-streaming-replication
Could you please check the permission on the folder where WAL Archive files are going. This might be the issue that user who own database do not have write permission on that folder that's why it is failing to write WAL file in that folder. Please use chmod and change permission on that folder. This might resolve the issue.
Regards.
Also check you don't have existing wal files that the archive_command
is trying to copy over, which is blocking it from writing wal files.
精彩评论