What is Consensus?
Consensus is how a group of servers agree on one value or
one ordered log of operations, even when some nodes crash or
messages are delayed. Every non-faulty node must eventually pick the
same result.
Typical problem: five database replicas receive write requests. Which
write is official? Consensus picks an order everyone follows so all
replicas stay consistent.
Raft and Paxos are general distributed-systems algorithms not
blockchain specific.
Products using Consensus: etcd, Consul, CockroachDB, TiKV (Raft);
Google Chubby, Spanner (Paxos family)
Raft vs Paxos
| Paxos | Raft (used in etcd, Consul, many DBs) | |
|---|---|---|
| What | quorum voting, no fixed leader; harder to implement, very proven (1990s, Leslie Lamport) | one leader replicates a log; easier to teach and build (2013); |
| Understanding | Hard — many phases, multi-Paxos for logs is subtle | Easier — leader election + log replication story |
| Leader | No permanent leader (proposers compete) | One leader at a time; followers only accept from leader |
| Roles | Proposers, Acceptors, Learners | Leader, Follower, Candidate |
| Mechanism | Prepare → Promise → Accept → Learn (majority quorum) | Elect leader → append entries → commit when majority acks |
| Typical use | Google infrastructure, custom high-reliability systems | etcd, Consul, CockroachDB, MongoDB-style replication |