Consul with patroni for multi datacenter PostgreSQL repliaction

Unlike Etcd, consul multi datacenter is build on separate clusters. Also, as far I can read in docs, there is no multi-master kv replication. But is it possible to create PostgreSQL + patroni multi datacenter cluster using Consul?

Hi @mkhdteam take a peek at this tool. It’s consul-replicate and you can use it to automate the replication process.

Hey @mkhdteam did you got expiriance with a patroni pgsql-cluster over two WAN-Federated Consul clusters? Did you find a valid working solution for production?

We did set this up (2 Consul DCs with consul-replicate) but I doubt consul-replicate will be helpful/sufficiant with this usecase.

  1. Consul-Replicate is very old, it even does not support TLSv13 and it looks like it is not being maintained anymore - Latest Version 0.4.0 was released in 2017.

  2. You would need to configure consul-replicate to replicate the K/V of patroni in both directions. This is needed because patroni members and leader are only known in the local consul datacenter.

  3. Unfortunately I’am not sure what side effects will arise when configuring consul-replicate to replicate the same K/V in both directions. At the moment testing looks okay even when the patroni leader is being moved to the 2nd consul datacenter.