vitabaks / postgresql_cluster

PostgreSQL High-Availability Cluster (based on Patroni). Automating with Ansible.
https://postgresql-cluster.org
MIT License
1.7k stars 412 forks source link

Question - Consul multi datacenter deployment #798

Open guillaumeldc opened 19 hours ago

guillaumeldc commented 19 hours ago

Thanks for the library, this has been very helpful so far. I'm trying different failure scenarios and there are a few things I have trouble understanding.

I'm using Consul with nodes deployed in 2 datacenter. DC1: 3 servers, 1 client DC2: 3 servers, 1 client

My understanding is that the raft protocol and Consul should work with 2 wan federated cluster in these two datacenter.

The setup with patroni however seems to require the use of only one cluster across 2 different datacenter. My questions are as follows:

thank you in advance for your help.

vitabaks commented 9 hours ago

Hi @guillaumeldc,

To ensure quorum, (N/2) + 1 nodes are required. You can find more details about how Raft works here. When distributing the DCS across multiple data centers, a third data center is necessary. More information on this can be found here.

If the second data center is only intended for Disaster Recovery (DR), you can set up two independent DCS clusters: one for the main Patroni cluster and another for the Standby Cluster (variable patroni_standby_cluster).