leader election pattern
Picking one node out of a cluster to be the coordinator/primary. Done via consensus (Raft, Paxos) or via lease-based primitives (ZooKeeper ephemeral nodes). Failures of the leader trigger a re-election; the cluster is briefly leaderless.
Picking one node out of a cluster to be the coordinator/primary. Done via consensus (Raft, Paxos) or via lease-based primitives (ZooKeeper ephemeral nodes). Failures of the leader trigger a re-election; the cluster is briefly leaderless.
symptoms
- need a single coordinator that can survive node failures
- split-brain during partitions
- leadership churn
causes
- need consistent decisions
- leader is bottleneck or SPOF
fixes
- Raft / Paxos for strong election
- ZooKeeper / etcd ephemeral leases
- fencing tokens to detect stale leaders
you might say
- leader election
- who owns the lock
- fail over to the next leader