On a master-slave replication setup (1 master with 2 slaves. the slaves are hot standby in case the master fails).

  1. How can I do a backup under normal circumstances? Are all nodes are backed up individually and restored accordingly to their own backup files?
  2. If the Master fails and one of the slaves is appointed the new master, how do I reintroduce the master? Will this old master become a slave now?

Thank you

  • 1
    Too many questions in one. Nov 15, 2022 at 16:28
  • I am sorry. I just edited. Now it has 2 questions. Thank you. @LaurenzAlbe
    – padjee
    Nov 16, 2022 at 3:12

1 Answer 1


This question is still too broad, but if you are happy with an answer with a similar lack of detail (and no, I won't write a tutorial):

  1. Since standby servers are physical copies of the primary, you only need to backup one of the instances. If the configuration files are different, then you will need a backup of all the configuration files.

  2. There is no automatic failover built into PostgreSQL. You either have to do it manually or use third-party software like Patroni for that. For manual failover, you can use pg_rewind to turn the failed primary into a new standby, and if that doesn't work, you reinitialize it with a new pg_basebackup.

  • thanks @LaurenzAlbe. It is just I can't find any reading on it that's why I ask here. . that's enough for me, no need to write tuts, that's my part of the journey to figure it out..
    – padjee
    Nov 16, 2022 at 9:10

Your Answer

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

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