Tuesday, January 14, 2014

Replication recovery after a prolonged shutdown slave Posgtgresql

t is possible that the slave will not receive data from the master after a prolonged shutdown of the slave 
Slave will return errors: 
  1. 2011-04-15 15:22:49 UTC FATAL: could not receive data from WAL stream: FATAL: requested WAL segment 0000000100000002000000C5 has already been removed

This is due to the fact that the master file is already fully recorded 0000000100000002000000C5 and moved it from the folder / var/lib/postgresql/9.0/main/pg_xlog in folder / var/lib/postgresql/9.0/main/archive. 

Required Actions: 

master 
  1. sudo-u postgres psql-c "SELECT pg_start_backup ('label', true)"
  2. cd / var/lib/postgresql/9.0/main
  3. tar cvzf ~ / archive.tgz archive
  4. sudo-u postgres psql-c "SELECT pg_stop_backup ()"
  5. scp-P 1022-r ~ / archive.tgz * @ *
  6. sudo-u postgres psql-c "SELECT pg_current_xlog_location ()"

slave 
  1. / Etc / init.d / postgresql stop
  2. tar xvzf ~ / archive.tgz-C / var/lib/postgresql/9.0/main
  3. chown-R postgres: postgres / var/lib/postgresql/9.0/main/archive
  4. / Etc / init.d / postgresql start
  5. sudo-u postgres psql-c "SELECT pg_last_xlog_replay_location ()"

No comments:

Post a Comment