我正在尝试使用 Postgres 9.1 设置同步复制,但我无法让它工作。我能够配置流复制,但不是同步的。我希望我没有错过任何明显的东西。我已经仔细阅读了管理员指南中第 17、18、14、25、26 和 29 章的许多部分。
我正在运行 ubuntu 12.04,我的主 postgresql.conf 具有这些,以及所有其他标准设置:
listen_addresses = '*' # what IP address(es) to listen on;
wal_level = archive # minimal, archive, or hot_standby
archive_mode = on # allows archiving to be done
archive_command = 'test ! -f /data/pgWalArchive/%f && cp %p /data/pgWalArchive/%f'
wal_keep_segments = 100 # in logfile segments, 16MB each; 0 disables ??? What should this be ????
max_wal_senders = 3 # max number of walsender processes
我的 pg_hba.conf 有这个,除了标准的东西:
host all all XX.6.35.0/24 md5
host replication postgres XX.6.35.0/24 md5
我的主数据库只有一个序列,所以它很小。我成功地在主服务器中创建了主服务器的备份并恢复了它:
sudo -u postgres pg_basebackup -D ~/backup -F tar -x -z -l ~/backup/base1 -v -h XX.6.35.51 -U postgres
我还将 WAL 归档文件复制到备用数据库。我的备用 recovery.conf 文件有这个:
restore_command = '/usr/lib/postgresql/9.1/bin/pg_standby /data/pgWalArchive %f %p %r'
archive_cleanup_command = '/usr/lib/postgresql/9.1/bin/pg_archivecleanup /data/pgWalArchive %r'
standby_mode = on
primary_conninfo = 'host=XX.6.35.51 port=5432' # e.g. 'host=masterIpAddressOrName port=5432'
两台服务器启动都没有问题,日志看起来还不错。我的待机有这个:
2012-06-08 10:23:51 MDT LOG: shutting down
2012-06-08 10:23:51 MDT LOG: database system is shut down
2012-06-08 10:23:53 MDT LOG: database system was shut down in recovery at 2012-06-08 10:23:51 MDT
2012-06-08 10:23:53 MDT LOG: entering standby mode
2012-06-08 10:23:53 MDT LOG: consistent recovery state reached at 0/1D000078
2012-06-08 10:23:53 MDT LOG: record with zero length at 0/1D000078
2012-06-08 10:23:53 MDT LOG: streaming replication successfully connected to primary
2012-06-08 10:23:53 MDT LOG: incomplete startup packet
2012-06-08 10:23:54 MDT FATAL: the database system is starting up
2012-06-08 10:23:54 MDT FATAL: the database system is starting up
2012-06-08 10:23:55 MDT FATAL: the database system is starting up
2012-06-08 10:23:55 MDT FATAL: the database system is starting up
2012-06-08 10:23:56 MDT FATAL: the database system is starting up
2012-06-08 10:23:56 MDT FATAL: the database system is starting up
2012-06-08 10:23:57 MDT FATAL: the database system is starting up
2012-06-08 10:23:57 MDT FATAL: the database system is starting up
2012-06-08 10:23:58 MDT FATAL: the database system is starting up
2012-06-08 10:23:58 MDT FATAL: the database system is starting up
2012-06-08 10:23:59 MDT FATAL: the database system is starting up
2012-06-08 10:23:59 MDT LOG: incomplete startup packet
2012-06-08 10:24:40 MDT LOG: redo starts at 0/1D000078
问题是当我对主人发表声明时,它们会永远挂起。我错过了什么吗?