Consensus & coordination · TL;DR
1 min readTL;DR
Consensus is how a group of machines agrees on one value — who the leader is, which write came next, who holds a lock — even when some of them crash or cannot talk to each other. The working tool is the majority quorum: any two majorities of the same group overlap, so a decision made by one majority cannot be contradicted by another. Raft turns that into a practical protocol: elect a leader for a numbered term, have it append entries to a replicated log, and commit an entry once a majority stores it. Most systems do not implement consensus themselves; they use a consensus service (etcd, ZooKeeper, Consul) for leader election, configuration and locks. The trap is time: a lock or lease can expire while its holder is paused, so every lock that protects a resource needs a fencing token that the resource checks.