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:
- For each slave node, I need to use pg_basebackup to sync and setup stream replication with the master node.
- 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).
- Setup Etcd on a node and configure it in the Patroni files of each node.