Consensus & Leader Election
Getting a group of unreliable machines to agree on one value, one leader, or one log.
Distributed SystemsAdvanced4 hrs4 key ideas · 3 applied designs
0%
your progressOverview
Getting a group of unreliable machines to agree on one value, one leader, or one log.
Key ideas
- Raft splits consensus into leader election, log replication and safety; a majority must acknowledge each entry.
- A cluster of 2f + 1 nodes tolerates f failures.
- Leases let a leader serve reads without a round trip, provided clocks are bounded.
- Fencing tokens (monotonic numbers) stop a deposed leader from corrupting shared state.
Trade-offs
- Every committed write costs a majority round trip — keep consensus off the hot path.
- Cross-region consensus makes latency a function of the speed of light.
In the real world
etcd and Consul (Raft)ZooKeeper (Zab)Spanner Paxos groups
Keywords
RaftPaxosLeasesFencing tokens