Author: yifei / Created: Jan. 18, 2018, 3:11 p.m. / Modified: Jan. 18, 2018, 11:12 p.m. / Edit

Why not others?

Client vs Server

Consul comes with 2 parts: client and server, The agents talk to one or more Consul servers. The Consul servers are where data is stored and replicated. The servers themselves elect a leader. While Consul can function with one server, 3 to 5 is recommended to avoid failure scenarios leading to data loss. A cluster of Consul servers is recommended for each datacenter.

These two DO articles are the best

Consul agent config

Consul service/health check config

Consul template


Normally you'll run a separate set of Consul servers (usually 3 or 5) and then run the Consul client agent on every other machine in your infrastructure. Applications always talk to the local Consul client agent, which will automatically forward requests to and keep track of the Consul servers. The Consul servers provide stable storage for the catalog, key/value store, and provide coordination for things like locks and semaphores. The Consul client agents on each other machine manage registering local services on that machine, and provide interfaces to Consul for applications on that machine (HTTP or DNS). There's usually no need to have redundancy at the Consul agent level on each machine, as that's part of the same failure domain as the machine itself.