Quick revision
The short answer
Consensus lets a group of nodes agree on a value, and repeated, on a sequence of values that forms a replicated log, with agreement, validity and progress while a majority is up. It needs a majority quorum because any two majorities share at least one node, so a decision made by one majority is always seen by the next, which prevents two different decisions after a partition. 2f + 1 nodes tolerate f failures: 3 nodes survive 1, 5 survive 2, and 4 nodes still survive only 1. Paxos came first and is proven but hard to implement in full; Raft solves the same problem with a design built for understandability and is used by etcd, Consul and Kafka's KRaft, while ZooKeeper uses its own protocol, ZAB.
What to remember
In this answer, we saw that consensus gives agreement, validity and termination, and that repeating it builds a replicated log so every node applies the same commands in the same order. A majority quorum works because any two majorities overlap, which carries each decision into every later one and prevents split brain. With 2f + 1 nodes we survive f failures, so 3 nodes survive 1, 5 survive 2, and 4 only 1. Paxos came first and is hard to implement fully, Raft was designed for understandability, and the FLP result means real systems keep safety always and rely on timeouts for progress.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Consensus lets a group of nodes agree on a value, and repeated, on a sequence of values that forms a replicated log, with agreement, validity and progress while a majority is up. It needs a majority quorum because any two majorities share at least one node, so a decision made by one majority is always seen by the next, which prevents two different decisions after a partition. 2f + 1 nodes tolerate f failures: 3 nodes survive 1, 5 survive 2, and 4 nodes still survive only 1. Paxos came first and is proven but hard to implement in full; Raft solves the same problem with a design built for understandability and is used by etcd, Consul and Kafka's KRaft, while ZooKeeper uses its own protocol, ZAB.
Why this question is asked
Consensus sits quietly under much of the infrastructure we use daily: Kubernetes stores its state in etcd, Kafka 4 manages its metadata with KRaft, and distributed SQL databases replicate every range of data with Raft. We rarely implement it ourselves, but we size clusters, place nodes and debug outages that only make sense if we know what it guarantees. Interviewers ask this question to check exactly that foundation. In this answer, we will see what problem consensus solves, why it needs a majority, how many failures each cluster size survives, how Raft and Paxos relate, and the theoretical limit that every real system works around.
1What Problem Consensus Solves
Imagine three servers that must hold the same configuration. Clients send changes to any of them, servers crash and restart, messages are delayed. Without a protocol, two servers could accept conflicting changes in different orders and end up with different configurations, with no way to tell which is right.
Consensus is the guarantee that this cannot happen. Formally, it provides agreement (all nodes that decide, decide the same value), validity (the decided value was actually proposed by some node, not invented) and termination (every working node eventually decides, as long as enough nodes are up and can talk).
Deciding one value is useful, but the real power comes from repeating it. If the nodes agree on what goes into slot 1 of a log, then slot 2, then slot 3, they build a replicated log: every node holds the same commands in the same order. Each node applies those commands to its own copy of a state machine, such as a key-value store, and since they apply the same commands in the same order, they all end in the same state. This is called state machine replication, and it is how etcd, ZooKeeper and KRaft work.
2Why a Majority Quorum
A quorum is the number of nodes that must agree before a decision counts. Consensus protocols use a majority, more than half, for a simple reason: any two majorities of the same group overlap in at least one node. In a cluster of 5, a majority is 3, and any two groups of 3 out of 5 must share at least one member.
That overlap is what carries decisions forward. Suppose nodes 1, 2 and 3 decide that slot 7 holds value X, and then the cluster is partitioned. Any later majority, say nodes 3, 4 and 5, contains at least one node, here node 3, that knows about X, and the protocol makes sure the later majority learns of it before deciding anything for slot 7. So two different values can never be chosen for the same slot, even after crashes and partitions. With a smaller quorum, two disjoint groups could each decide, which is split brain.
| Nodes | Majority | Failures tolerated | Note |
|---|---|---|---|
| 1 | 1 | 0 | no fault tolerance |
| 3 | 2 | 1 | the common minimum |
| 4 | 3 | 1 | no better than 3, more voters to wait for |
| 5 | 3 | 2 | common for critical clusters |
| 7 | 4 | 3 | rarely worth the latency |
3Counting Failures: 3, 4 and 5 Nodes
The rule is that 2f + 1 nodes tolerate f failures, because after f failures the remaining f + 1 nodes are still a majority. A 3-node cluster survives 1 failure: 2 remaining nodes are a majority of 3. A 5-node cluster survives 2: 3 remaining are a majority of 5.
A 4-node cluster is the trap. Its majority is 3, so after 2 failures the remaining 2 are not a majority and it stops. It survives only 1 failure, exactly like 3 nodes, but every write must now wait for 3 acknowledgements instead of 2, and there is one more machine that can fail. That is why consensus clusters almost always have an odd number of voters. Note too that more nodes does not mean more throughput: every write still goes through the leader and a majority, so larger clusters are usually a little slower.
4How Raft and Paxos Relate
Paxos, described by Leslie Lamport, came first. Basic Paxos decides a single value through two phases, prepare and accept, and is proven correct. To build a log, systems use Multi-Paxos, which elects a stable leader to skip the first phase for most slots. The core is compact, but the full system, with leader election, log gaps, membership changes and snapshots, was left largely to implementers, and it became famous for being hard to get right.
Raft, published in 2014 by Diego Ongaro and John Ousterhout, solves the same problem with understandability as an explicit goal. It has a strong leader that alone appends to the log, numbered terms that act as logical time, randomised election timeouts and explicit rules for when an entry is committed and how followers' logs are repaired. It is used by etcd, Consul, CockroachDB, TiKV and Kafka's KRaft. ZooKeeper uses its own protocol, ZAB (ZooKeeper Atomic Broadcast), which is similar in spirit, with a leader and epochs.
In terms of what they guarantee, the protocols are close relatives: Raft can be seen as a particular, well-specified form of Multi-Paxos. The practical difference is how easy it is to implement and reason about the whole system.
5The Limit Every System Works Around
A famous result by Fischer, Lynch and Paterson, called FLP, says that in a fully asynchronous network, where messages can be delayed for any length of time, no deterministic protocol can guarantee that consensus always terminates if even one node may crash. The reason is that a slow node and a crashed node look the same, so the protocol can be kept undecided forever by unlucky timing.
Real systems accept this by separating safety from liveness. Safety, never deciding two different values, holds always, regardless of timing. Liveness, eventually deciding, relies on timeouts: when the network behaves reasonably, timeouts elect a leader and progress resumes. During a long partition or a storm of elections, the cluster may stop making progress, but it never makes a wrong decision.
- Client sends command to the leadere.g. set /config/flag = on
- Leader appends it to its log
- Leader replicates to followers
- Stored on a majority?YesEntry is committedNoKeep retrying; do not apply
- Every node applies it in log ordersame state on every node
- Leader replies to the client
6 steps in order. Play them, or step through them one at a time.
6Follow-up questions
Why not use an even number of nodes to spread across two data centers?
Because an even split gives no majority to either side when the link between them fails, so the whole cluster stops. Surviving the loss of a site needs at least three sites, for example 2 + 2 + 1, so whichever site is lost, a majority remains.
Does consensus make the system faster or more available for reads?
It makes the data available after failures, not faster. Linearizable reads still need the leader to confirm it is still leader, through a quorum round or a lease. Reads from followers are faster but may be stale unless the protocol adds a read index or similar check.
Is consensus the same as two-phase commit?
No. Two-phase commit makes several participants all commit or all abort a transaction, and it blocks if the coordinator fails. Consensus makes a group agree on values and keeps working while a majority is up. Distributed databases often use both: consensus to replicate each shard, two-phase commit across shards.
7Conclusion
In this answer, we saw that consensus gives agreement, validity and termination, and that repeating it builds a replicated log so every node applies the same commands in the same order. A majority quorum works because any two majorities overlap, which carries each decision into every later one and prevents split brain. With 2f + 1 nodes we survive f failures, so 3 nodes survive 1, 5 survive 2, and 4 only 1. Paxos came first and is hard to implement fully, Raft was designed for understandability, and the FLP result means real systems keep safety always and rely on timeouts for progress.
Open with
Consensus lets a group of nodes agree on a value even when some crash or messages are delayed. It guarantees agreement, so everyone decides the same value; validity, so the value was actually proposed; and termination, as long as a majority is up and can communicate.
Then, if they want more
Repeated slot by slot, it builds a replicated log, so every node applies the same commands in the same order and ends in the same state; that's how etcd, ZooKeeper and KRaft work.
It needs a majority quorum because any two majorities of the same cluster share at least one node, so a value chosen by one majority is always known to every later majority, and two different decisions after a partition are impossible.
With 2f plus 1 nodes you tolerate f failures: 3 nodes survive one failure, 5 survive two, and 4 still survive only one, because a majority of 4 is 3, so even sizes add cost without adding tolerance. Paxos came first; it's proven, but Multi-Paxos for a log leaves a lot to implementers and is hard to get completely right.
Raft solves the same problem with a strong leader, terms and explicit log rules, designed to be understandable, and it's used by etcd, Consul and KRaft. ZooKeeper uses its own protocol, ZAB. And because of the FLP result, no protocol can guarantee termination in a fully asynchronous network, so real systems keep safety always and use timeouts for progress.
About this answer
- Last updated
- 13 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "What problem does consensus solve, why does it need a majority quorum, how many failures...": https://scrivio-interview-library.netlify.app/architecture/distributed-systems/b200b624f0/