How does service A find out where service B is running? Hardcoded IP? Load balancer? Consul from HashiCorp offers an elegant solution: service discovery with health checking, a KV store, and a DNS interface — all in one.
Registration and health checks¶
{
"service": {
"name": "user-api",
"port": 8080,
"tags": ["v2", "production"],
"check": {
"http": "http://localhost:8080/health",
"interval": "10s"
}
}
}
DNS interface: user-api.service.consul returns the IPs of healthy instances.
Any application that can use DNS benefits from this without any integration effort.
Consul vs. etcd vs. ZooKeeper¶
etcd: pure KV, no service discovery. ZooKeeper: robust, but complex. Consul: the most complete solution — SD + health checks + KV + DNS.
Service discovery is a prerequisite for microservices¶
Consul is currently the best choice. Deployment takes a day; operations are trouble-free.
Need help with implementation?
Our experts can help with design, implementation, and operations. From architecture to production.
Contact us