in the case where we have SERVER1 (prod db) and SERVER2 (hot standby), what happens to the WAL files from SERVER1 when SERVER2 goes into recovery mode and is opened?

On SERVER1, the ARCHIVE_COMMAND looks like this

test ! -f SERVER2:$PGDATA/pg_xlogArchive/%f && scp %p SERVER2:$PGDATA/pg_xlogArchive/%f

on SERVER2, the RESTORE_COMMAND looks like this

cp -f /vol2/postgres92/pgsql/data/pg_xlogArchive/%f /vol2/postgres92/pgsql/data/pg_xlog

all works ok, and when the trigger file is created both SERVER1 and SERVER2 are available for writes. But as the ARCHIVE_COMMAND on SERVER1 remains in place I was expecting the WAL files to continue to be shipped to SERVER2 into the SERVER2:$PGDATA/pg_xlogArchive/%f location, but they aren't. So how does SERVER1 know to stop shipping the logs?

thanks Dave

  • In the first place, why do you promote the slave when the master is still running? It is a recipe for disaster... – dezso Oct 12 '15 at 13:36
  • we have a process which can sometimes fail. So we want to try stopping the shipping of log files to slave before this process starts, then if there is a problem on live we can repoint our application back to the slave (which is now in a writable state with data from before the failover) – davegreen100 Oct 12 '15 at 13:38
  • What does the server log file say? Any messages about archive failure? – jjanes Oct 12 '15 at 16:20
  • no, no messages of failure in the logs. Is my understanding correct in thinking at the logs should continue to be shiipped but not applied? – davegreen100 Oct 13 '15 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.