Does/should the primary datacenter ever change?

Pretty much what it says on the tin. If I build out a greenfield consul setup do I need to take into account any situation where the primary dc would change?

I suspect the answer is “no”, but I figured I’d ask anyway because “there are no stupid questions” (but there are bad architectural assumptions that slowly bury you under a mountain of crippling tech debt).

The principle behind a second data center is the redundancy/ reliability (hot or cold standby, load balancing, mesh) of all business relevant services. If you can use this, you should always consider a switchover or failover (and also test it cyclically!). Otherwise redundancy is not required.
In other words, if the data center 1 blows up, data center 2 should take over and the admin should be able to sleep well. :wink:

Oh, haha, I understand the basic reasoning for multiple datacenters. I have been learning so many new things about HashiStack lately that I somehow thought Consul had some special concept of datacenters. Sounds pretty normal.

Thanks for the response, @Wolfsrudel

2 Likes

Hi @tvon!

Thanks for the question, and welcome to the forums :slight_smile: I wanted to add some more information, just in case others my find it helpful.

A datacenter is a networking environment that is private, low latency, and high bandwidth. Nodes in the same datacenter should be on a single LAN. As per the definition, this likely wouldn’t “change” often.

Thanks for asking the question though, as it is likely others may be confused.

Have a great day!

Ref:

Not only should you not need to account for the primary DC changing but many features of Consul rely on having a stable primary DC. For example, Consul’s ACL system will perform all writes (except for DC local tokens) within the primary DC and then replicate the data out to all the other datacenters. The primary DC is the source of truth for ACL policies, roles etc. If you were to manually change your primary datacenter configuration after setting all of this up, lots of things would stop working. It might in theory be possible to change your primary DC but this would require a lot of coordination and planning and is not something you should ever hope to do.

Related discussion: Is it possible to change the "primary datacenter" for Consul clusters?.

Hi All,

I’ve created an issue to track this for discussion. Please upvote the issue to raise visibility, and add your use cases for rotating primary DC.

Hope this helps!
Jono.