配置热流复制时 postgresql 9.0 归档出错
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4776015/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error from postgresql 9.0 archiving while configuring hot streaming replication
提问by Bharath
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/
我正在尝试在 postgresql 9.0 上运行流式复制。我正在按照链接中提到的步骤操作: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 commands in the following order:
当我尝试在 postgresql 上执行归档命令时,我收到警告,要求我无休止地等待。我按以下顺序执行命令:
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.
这会继续下去,警告永远不会结束。请让我知道是否有人遇到过这个问题。
回答by araqnid
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
您已archive_command
按照您指定的链接中的说明设置了一个?它实际上是否正确地将 xlog 文件复制到安全位置?服务器的输出表明它不是,并且内部正在积压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 doneed 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
.
我似乎记得您实际上并不需要在服务器上启用存档以将其用作副本中的主服务器。您确实需要wal_level
设置为hot_standby
. 有了该设置,您的副本就可以连接到主服务器以独立于传统的 xlog 归档过程来流式传输 xlog 记录。所以尝试设置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.
编辑:更详细地阅读链接,您需要设置 archive_mode 来创建基本备份,这是有道理的。所以要么修复存档命令,以便您可以正确进行基本备份,要么在服务器停止时进行基本备份。
回答by eggie5
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
如果您只想在第 9 页中使用新的 SR,请不要将存档弄得一团糟。一开始我也遇到了问题。我写了一个无存档的准系统设置教程,将主复制到从:http: //eggie5.com/15-setting-up-pg9-streaming-replication
回答by Ashok
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.
您能否检查 WAL 存档文件所在文件夹的权限。这可能是拥有数据库的用户对该文件夹没有写权限的问题,这就是无法在该文件夹中写入 WAL 文件的原因。请使用 chmod 并更改该文件夹的权限。这可能会解决问题。
Regards.
问候。
回答by Martlark
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.
还要检查您是否没有archive_command
试图复制的现有 wal 文件,这会阻止它写入 wal 文件。