Postgres复制:不完整的启动包

时间:2014-03-25 22:54:00

标签: postgresql database-replication postgresql-9.3

我最近在单个主/从之间配置了PostgreSQL 9.3热备份复制。

我今天再次检查了备用服务器,看起来它无法完成并在重启时退出恢复模式:

2014-03-25 22:36:07 UTC LOG:  entering standby mode
2014-03-25 22:36:07 UTC LOG:  incomplete startup packet
2014-03-25 22:36:07 UTC LOG:  redo starts at 7/E1091840
2014-03-25 22:36:07 UTC LOG:  consistent recovery state reached at 7/E10929C8
2014-03-25 22:36:07 UTC LOG:  record with zero length at 7/E10929C8
2014-03-25 22:36:07 UTC LOG:  started streaming WAL from primary at 7/E1000000 on timeline 1
2014-03-25 22:36:08 UTC FATAL:  the database system is starting up
2014-03-25 22:36:08 UTC FATAL:  the database system is starting up
2014-03-25 22:36:09 UTC FATAL:  the database system is starting up
... more ...
2014-03-25 22:36:13 UTC LOG:  incomplete startup packet

我尝试手动将WAL记录从主服务器复制到从服务器并且我得到相同的错误,所以我想知道主服务器上的WAL记录是否有问题?

2 个答案:

答案 0 :(得分:2)

我解决了同样的问题

 psql -c "select pg_start_backup('initial_backup');"
 rsync -cva --inplace --exclude=*pg_xlog* /var/lib/postgresql/9.1/main/ slave_IP_address:/var/lib/postgresql/9.1/main/
 psql -c "select pg_stop_backup();"

here is a good tutorial !!

答案 1 :(得分:1)

我在PostgreSQL 9.4中遇到了同样的问题

原因是在我的系统中postgresql.conf和pg_hba.conf位于/ etc / postgresql中,因此在pg_startbackup期间它们没有从master进入待机状态

因此,我在master上有wal_level = hot_standby,在待机状态下默认wal_level = minimal。这会在日志中生成相同的图片。

我的决定是将postgresql.conf修复为待机状态。待机状态开始后,确定已准备好接受只读连接。