"Leader service" with DNS support
- Dominant language
- Go
- Stars
- 30.1k
- Forks
- 4.6k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 39
Description
A very nice feature of Consul is the load balancing provided by the DNS service when looking up a service by hostname if there are multiple instances of a service. However, if you have multiple instances of a service but at any given time you only want one of them to be serving requests, this seems not to be supported by Consul out of the box. You could certainly implement this functionality using the leader election mechanism outlined [here](https://www.consul.io/docs/guides/leader-election.html) but I think that it would be an interesting option to support this through Consul's service mechanism including DNS support, maybe something like the following:
- Consul supports defining a service as a "leader service" where only one instance should be active at any given time
- Consul performs a leader election among all instances of the service registered on the cluster
- Consul's DNS service always returns the IP of the leader among all service instances (instead of doing a load balancing)
Such a mechanism would make it possible to get automatic failover for a service.
Would something like this make sense?
Contributor guide
Research direction
Start with Consul's service mechanism and DNS service, then read the linked leader-election guide to understand the proposed behavior. Define how leader election, service registration, failover, and DNS responses should interact; the issue does not identify implementation files or tests.
Written by the indexing model from the issue text.
Assessment
- Domain
- distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100