I am building a HA Postgres db cluster with one master and multiple slaves. Please look at the below points and correct me if I am wrong:

  1. For each slave node, I need to use pg_basebackup to sync and setup stream replication with the master node.
  2. Setup Patroni on each node so that the leader can be elected from any of the available nodes in case of master failure (In this case, if the master fails, a slave node will be elected as master and write operations will be handled by it. Now if the master comes online and becomes the master of the cluster, then will the master sync with the previous master i.e. updated slaves).
  3. Setup Etcd on a node and configure it in the Patroni files of each node.

1 Answer 1



  1. Patroni will automatically perform pg_basebackup.

  2. see the answer to 3.

  3. If you have a single etcd, you have a single point of failure. No good. You need to setup an etcd cluster on three nodes that don't share any hardware. Patroni communicates with that etcd cluster to determine who is up or down and who is to be the primary.

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.