Leader Election
The process a distributed system uses to pick one node to coordinate, and to notice and replace it when it dies.
Leader election is the process by which a group of nodes agrees on one of themselves to act as the coordinator for some duty — accepting writes, sequencing events, owning a lock — and, crucially, detects when that leader has failed and elects a replacement. Almost every system with a single primary and multiple replicas needs this somewhere: a replicated database needs to know which node currently accepts writes, and a cluster of worker processes doing the same job needs exactly one of them running a scheduled task rather than all of them or none.
The mechanism nearly always rests on a Consensus Algorithm like Raft, because "pick a leader" is really "get every node to agree on the same leader despite messages arriving late or not at all," which is the exact problem consensus protocols solve. A common building block is the lease: a node holds leadership only until a time-bounded lease expires, and must keep renewing it to stay leader, which bounds how long a network partition can leave two nodes each believing they're the leader.
That dual-leader scenario — split brain — is the failure mode leader election exists to prevent, and the one that shows up when it's implemented wrong. If a network partition isolates the current leader from the rest of the cluster, and the rest elects a new one, the old leader may keep acting as leader from its own isolated point of view, accepting writes nobody else will ever see. Correct implementations guard against this with fencing tokens or lease timeouts strict enough that an isolated leader stops trusting itself before a majority elsewhere can safely proceed without it.
See also6
Database Replication
Copying the same data to multiple database nodes for redundancy and read scale, at the cost of a lag window.
Data & Content13 connections
CAP Theorem
When a network splits a distributed system, it can stay consistent or stay available, but a proven theorem says not both.
Data & Content12 connections
Two-Phase Commit
A protocol for committing one transaction across multiple databases atomically, at the cost of blocking if the coordinator dies.
Data & Content10 connections
Cross-Tab Communication
Keeping several open tabs of the same app consistent, best done by broadcasting small notifications and letting each tab re-read the truth.
Web Platform15 connections
Failure Detection
How the nodes of a distributed system decide that a peer has died, using heartbeats and timeouts, when a crashed node and a slow one look exactly the same from outside.
Networks & Distribution11 connections
Watchdog Timer
A countdown that resets a system unless healthy software keeps restarting it, the last line of defense against hangs in spacecraft, routers, and servers.
Systems & Tooling9 connections
Linked from8
- Chaos EngineeringTesting & Verification
Deliberately breaking parts of a running system to prove it survives failures that will eventually happen anyway.
- Consensus AlgorithmData & Content
A protocol that gets a majority of unreliable, independent nodes to agree on one value, surviving any minority failing.
- Cross-Tab CommunicationWeb Platform
Keeping several open tabs of the same app consistent, best done by broadcasting small notifications and letting each tab re-read the truth.
- Database ReplicationData & Content
Copying the same data to multiple database nodes for redundancy and read scale, at the cost of a lag window.
- Failure DetectionNetworks & Distribution
How the nodes of a distributed system decide that a peer has died, using heartbeats and timeouts, when a crashed node and a slow one look exactly the same from outside.
- Network PartitionNetworks & Distribution
A network failure that splits a cluster into groups that can't reach each other but keep running, and the split brain that follows when each side thinks it is in charge.
- Time to LiveNetworks & Distribution
A limit on how long something may live, counted in hops or seconds, which keeps lost packets from circling forever and tells caches when their copies go stale.
- Watchdog TimerSystems & Tooling
A countdown that resets a system unless healthy software keeps restarting it, the last line of defense against hangs in spacecraft, routers, and servers.