Hosting postgres wal logs on a separate dedicated server with failover setup

by WhiteSword   Last Updated November 14, 2018 14:06 PM

a postgres novice here, so sorry if my questions don't sound meaningful. My postgres server setup goes as follows:

Master(on server A), Upstream(on B, receiving wal from A), Downstream(on C, receiving wal from B). A is streaming wal logs on a few physical_replication_slots. All the other servers are created from pg_basebackup of A.

Now, I've another server X, dedicated to WAL storage. Whatever be the primary at the moment, its wal logs will be dumped on X inside directory(say /root/wal_logs). There's a pg_receivewal(on server X) process receiving this wal from Master and saving it in the same directory.

Under failover scenarios, slaves are promoted to master, and others act like slaves. So, I wanted to know,

  • How the logs on server X will be affected if masters keep on switching ? Can a new master server create a wal conflicting with the old server's wal ?
  • What if I create a new standby( D ) from pg_basebackup of A, and try recovering it from these logs ? There was some Timeline kinda concept(which I couldn't grasp much) in postgres wals. Can it have effect on recovery of D ?
  • And is it possible, for a Master demoted to standby, recover from these logs ? Or will I need pg_rewind for this?
  • Otherwise, what's the recommended way to do it ?


Related Questions



Metrics for monitoring master-slave replication

Updated December 07, 2016 08:02 AM


Too much data queued in replication slots

Updated September 12, 2017 13:06 PM