0

I've setup a master / slave Postgresql (13.4) group, 1 master and 1 slave, using WAL warm standby.
(refer: https://postgresql.org/docs/current/warm-standby.html#STANDBY-SERVER-SETUP)

But, due to some reason, the slave is out of sync for a while, then due to the WAL file not exists anymore on the master, the slave can't sync anymore.

Question:
A. Is there anyway to recover the slave, to get back to sync ?
B. Or is there anyway to re-create the slave without stop the running master?

Either A or B is acceptable.

Thanks.

1 Answer 1

1

Is there anyway to recover the slave, to get back to sync ?

No, unless you have archive WAL of all segments between current standby and primary server

Or is there anyway to re-create the slave without stop the running master?

Just simple native pg_basebackup command.

  • stop current replica
  • remove datadir (and tablespaces if any) on replica
  • run pg_basebackup with appropriate oprions (typically I use -R -X stream -c fast -P -U <replicationuser> -h source_addr, -R is mandatory to start replica, not new primary)
  • start DB and watch its logs
2
  • I've created another question above avoiding further slave out of sync, could also take a look if interested, thanks. Link: dba.stackexchange.com/questions/303868/…
    – Eric
    Dec 13, 2021 at 8:17
  • Ok, now slave recovered & working !
    – Eric
    Dec 13, 2021 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.