Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgres Replication: Incomplete Startup Packet

I recently configured PostgreSQL 9.3 hot standby replication between a single master/slave.

I've checked my standby server again today and it looks like it is unable to complete and exit recovery mode on restart:

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

I've tried manually copying over WAL records from the master to the slave and I get the same errors, so I wonder if the WAL records on the master are the problem?

like image 425
Kyle Avatar asked Oct 02 '22 05:10

Kyle


2 Answers

i solved the same problem re doing

 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 !!

like image 107
mullerivan Avatar answered Oct 05 '22 11:10

mullerivan


I have got the same issue with PostgreSQL 9.4

The reason was that in my system postgresql.conf and pg_hba.conf are situated in /etc/postgresql, so they didn't came to standby from master during pg_startbackup

As a result I has wal_level = hot_standby on master and default wal_level = minimal on standby. This produces the same picture in log.

My decision was to fix postgresql.conf on standby. After that standby started Ok and said it was ready to accept readonly connections.

like image 25
Konstantin Popov Avatar answered Oct 05 '22 11:10

Konstantin Popov