Does Consul KV store support cross side data strongly consistency?

We want to deploy Consul to 3 datacenters for high availability. But does Consul KV store support cross datacenter data strongly consistency?

Hi @fathandpbqi ,

Thanks for posting, and welcome to the Forums! Consul actually provides various consistency models that can be applied per query via parameters. The docs there describe some usecases :slight_smile: Hope this helps!

Hi, @jsosulska ,

Thanks a lot for the reply! I have go through the docs, but I can’t see any statements explicit indicate that Consul can support cross datacenter data strong consistence. And from the page below, seems it can’t, it need some replication works.

Could you pls help to confirm, it’s important to our current projects.

Hi @fathandpbqi,

The consistency modes that @jsosulska shared only work within the context of a single DC. Consul does not support cross-DC replication of the KV store, and thus cannot support strongly consistent, cross-DC KV writes.

This comment on a related issue for cross-DC locks provides additional info with regard to the design decisions in Consul which make it unsuitable to also support your cross-DC KV write use case.

By design cross-DC coordination is not really possible in Consul. We try to keep separate DCs as independent as possible which is why KV and catalog are not replicated directly.

For that reason, you can’t create locks across DCs - there is no consensus protocol operating between the two independent DCs so there is no way to enforce the safety guarantees needed for a lock.

I’d instead recommend you re-think your architecture so only nodes in the same DC coordinate via locks and cross DC uses another strategy that is more tolerant of partitions. If you can’t do this, then Consul doesn’t really provide strong enough guarantees by design for what you need - you may need to consider implementing your own consensus protocol across your DCs!


Ah, thank you @blake! :slight_smile: #TIL!