Skip to content

Instantly share code, notes, and snippets.

@armon
Last active Sep 27, 2020
Embed
What would you like to do?
Running Consul as a global K/V store

Simplest way to do this with Consul is to run a single "global" datacenter.

This means the timing for the LAN gossip need to be tuned to be WAN appropriate. In consul/config.go (https://github.com/hashicorp/consul/blob/master/consul/config.go#L267) Do something like:

// Make the 'LAN' more forgiving for latency spikes
conf.SerfLANConfig.MemberlistConfig = memberlist.DefaultWANConfig()

Then we need to tune the Raft layer to be extremely forgiving. In that same method I'd add the following:

// Make Raft more WAN friendly
conf.RaftConfig.HeartbeatTimeout = 5000 * time.Millisecond
conf.RaftConfig.ElectionTimeout = 5000 * time.Millisecond
conf.RaftConfig.CommitTimeout = 100 * time.Millisecond
conf.RaftConfig.LeaderLeaseTimeout = 2500 * time.Millisecond
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment