Guide

A cluster of machines must sometimes make one decision, such as "who is the leader?". If two groups of nodes each decide alone, you get split brain. A majority quorum prevents that. A decision needs more than half of the nodes to accept it.

Concept

Before you start. A crash is a node that stops responding. A partition is a network split that cuts nodes off from each other. A quorum is the minimum number of nodes whose agreement counts. See failure models for more on crashes and pauses.

The big idea

Think of a committee of five. A motion passes with three votes. Two different motions cannot both get three votes out of five, because the two groups of three must share at least one member. That shared member cannot vote for both.

This overlap is the whole trick. Any two majorities of the same set share at least one node. The protocol forbids that node from accepting two conflicting values.

Walking through it

With n nodes, a majority is more than half. Write n = 2f + 1. Then the majority is f + 1, and the cluster keeps working while up to f nodes are down.

Cluster sizeMajorityFailures tolerated
110
220
321
431
532
743

Look at the 3 and 4 rows. Four nodes tolerate exactly one failure, the same as three. The fourth node adds cost and one more machine to write to, and gives no extra safety. That is why clusters are almost always 3 or 5 nodes.

During a partition, the side with a majority keeps going. The minority side cannot commit anything. That is consensus choosing consistency over availability.

Common mistakes

  • Using an even number of nodes for extra safety. Four nodes tolerate the same single failure as three.
  • Thinking a majority means all nodes. Only f + 1 of 2f + 1 need to agree.
  • Spreading nodes unevenly across zones. Two nodes in one zone and one in another means losing the first zone loses the quorum.

Check yourself

  1. How many failures does a 7-node cluster tolerate? Three. A majority is four, so three nodes can be down.
  2. Why can't two conflicting values both get a majority in a 5-node cluster? Each majority has at least three nodes out of five, so the two groups overlap. The shared node cannot accept both values.

Key takeaways

  • A decision needs more than half the nodes to agree.
  • Any two majorities overlap, so conflicting decisions cannot both win.
  • 2f + 1 nodes tolerate f failures.
  • Use 3 or 5 nodes. Even sizes add cost without extra safety.

Further learning

Next, see how Raft uses this rule to choose a leader in Raft leader election.

The Raft site has an animated visualization of majorities and elections.

Raft Consensus AlgorithmRaft is a consensus algorithm that is designed to be easy to understand.raft.github.io