I am using 9.2 PostgreSQL, and I was just playing with configuration files.
The following things I have done:
- stopped slave server
- renamed
recovery.conf
torecovery.conf.sample
- restarted slave server
Now rsyncing has completely stopped.
After this, I tried restarting slave with recovery.conf
again (as it was in working state).
Now my master has 1002 records and it's working fine, but my slave has 97 records only.
My question is how do I make slave sync with master without shutting down the master?
This is from archive_status:
[a number of .done files for earlier segments]
-rw------- 1 postgres postgres 0 Oct 20 16:12 0000000100000074000000B9.done
-rw------- 1 postgres postgres 0 Oct 20 16:22 0000000100000074000000BA.ready
-rw------- 1 postgres postgres 0 Oct 20 18:11 0000000100000074000000BB.done
while wals has
-rw------- 1 postgres postgres 16777216 Oct 20 17:09 0000000100000074000000BA
[... without a gap ...]
-rw------- 1 postgres postgres 16777216 Oct 21 13:09 0000000100000074000000CE
These are logs when I stopped it for the first time and started without recovery.conf
:
LOG: shutting down
LOG: database system is shut down
LOG: database system was shut down in recovery at 2016-10-20 16:16:01 IST
LOG: database system was not properly shut down; automatic recovery in progress
LOG: redo starts at 74/BA02B158
LOG: consistent recovery state reached at 74/BA057B90
LOG: invalid record length at 74/BA057B90
LOG: redo done at 74/BA057B60
LOG: last completed transaction was at log time 2016-10-20 16:15:25.688431+05:30
LOG: autovacuum launcher started
LOG: database system is ready to accept connections
ssh: connect to host <host_address> port 22: Connection timed out
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(600) [sender=3.0.6]
FATAL: archive command failed with exit code 255
DETAIL: The failed archive command was: rsync -a pg_xlog/000000010000004800000060 postgres@<host_address>:/var/lib/pgsql/9.2/wals/000000010000004800000060 </dev/null
LOG: archiver process (PID 9747) exited with exit code 1
And these are logs when I stopped it for the second time and started again with recovery.conf
cp: cannot stat `/var/lib/pgsql/9.2/wals/0000000100000074000000BB': No such file or directory
cp: cannot stat `/var/lib/pgsql/9.2/wals/0000000100000074000000BB': No such file or directory
LOG: invalid record length at 74/BB000080
cp: cannot stat `/var/lib/pgsql/9.2/wals/0000000100000074000000BB': No such file or directory
cp: cannot stat `/var/lib/pgsql/9.2/wals/0000000100000074000000BB': No such file or directory
LOG: invalid record length at 74/BB000080
LOG: restored log file "0000000100000074000000BB" from archive
LOG: invalid record length at 74/BB000080
LOG: invalid record length at 74/BB000080
LOG: restored log file "0000000100000074000000BB" from archive