Distributed systemsdistributed consensuspaxosraftzab

Consensus

Definition

Consensus is the problem of making a set of nodes agree on a single value (or a sequence of values) such that every non-faulty node decides the same thing and the decision is never reversed; Paxos, Raft and ZAB are common protocols for it.

In practice

Consensus is the foundation under leader election, replicated configuration stores such as etcd and ZooKeeper, and linearizable databases. A value counts as decided once a majority has accepted it, so a cluster of 5 keeps working with 2 nodes down. Proposals carry a monotonically increasing round number (a term in Raft, a ballot in Paxos) so stale leaders are rejected.

Consensus costs at least one majority round trip per decision, so it is slow across regions and caps write throughput. It cannot make progress without a majority: a cluster split 2 and 3 serves writes only on the side with 3. Most systems use consensus for small, critical metadata and replicate bulk data by cheaper means.

Example

A 3-node etcd cluster commits a configuration change once 2 nodes have written it to their logs; if one node fails, the other 2 still form a majority and keep accepting writes.