I've started a new SLAVE PostgreSQL server set up.
* NOTE: I run the pg_basebackup from another STANDBY SERVER. Not from the MASTER
1 - screen -t basebackup
2 - su - postgres
3 - cd ~/9.2/data/
4 - ssh postgres@slave01 'pg_basebackup --pgdata=- --format=tar --label=bb_master --progress --host=localhost --port=5432 --username=replicator --xlog | pv --quiet --rate-limit 100M' | tar -x --no-same-owner
5 - I've commented the "primary_conninfo =" and "standby_mode=" so the slave can get the files from WAL_ARCHIVE
6 - Afte I got the logs:
postgres(iostreams)[10037]: 2016-01-09 00:07:26.604 UTC|10085|LOG: database system is ready to accept read only connections
7 - After the server finished the WAL_ARCHIVE, I turned on replication from MASTER on recovery.conf:
recovery.conf on the New Slave:
restore_command = 'exec nice -n 19 ionice -c 2 -n 7 ../../bin/restore_wal_segment.bash "../wal_archive/%f" "%p"'
archive_cleanup_command = 'exec nice -n 19 ionice -c 2 -n 7 ../../bin/pg_archivecleaup_mv.bash -d "../wal_archive" "%r"'
recovery_target_timeline = 'latest'
standby_mode = on
primary_conninfo = 'host=192.168.100.XX port=5432 user=replicator application_name=replication_slave02'
But, once I've restarted the POSTGRESQL I got this error:
WAL segment `../wal_archive/00000005.history` not found
2016-01-09 01:13:39.183 UTC|774|FATAL: timeline 2 of the primary does not match recovery target timeline 4
What can I do to solve the problem?
It's really important as it's a production New Slave. Thank you!