7

我正在尝试在 postgresql 9.0 上运行流复制。我正在按照链接中提到的步骤操作:http: //brandonkonkle.com/blog/2010/oct/20/postgres-9-streaming-replication-and-django-balanc/

当我尝试在 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();

为此,我得到以下输出:

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.

这继续进一步,警告永远不会结束。请让我知道是否有人遇到过这个问题。

4

4 回答 4

2

您已archive_command按照您指定的链接中的说明设置了吗?它实际上是否将 xlog 文件正确复制到安全位置?服务器的输出表明它不是,并且内部正在积压pg_xlog

我似乎记得您实际上不需要在服务器上启用归档即可将其用作副本中的主服务器。您确实需要wal_level设置为hot_standby. 通过该设置,您的副本可以连接到主服务器以独立于传统的 xlog 归档过程来流式传输 xlog 记录。所以尝试设置archive_mode=off

编辑:更详细地阅读链接,您需要设置 archive_mode 来创建基本备份,这是有道理的。所以要么修复存档命令,以便您可以正确地进行基本备份,或者在服务器停止时进行基本备份。

于 2011-01-24T01:04:46.800 回答
1

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

于 2011-02-02T08:19:18.987 回答
1

您能否检查 WAL 存档文件所在文件夹的权限。这可能是拥有数据库的用户对该文件夹没有写入权限的问题,这就是它无法在该文件夹中写入 WAL 文件的原因。请使用 chmod 并更改该文件夹的权限。这可能会解决问题。

问候。

于 2012-08-30T08:24:45.790 回答
0

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.

于 2018-08-29T04:06:49.050 回答