← Lessons

quiz vs the machine

Platinum1750

System Design

Split Brain Prevention

Stopping a partition from creating two leaders that both think they are in charge.

5 min read · advanced · beat Platinum to climb

The danger

A split brain happens when a network partition cuts a cluster in two and each side believes the other is dead. Both elect a leader, both accept writes, and when the partition heals the two histories conflict. This can corrupt data badly.

Quorum is the cure

The standard defense is a majority quorum. A side may act as leader only if it can reach more than half the nodes. Since both sides cannot each hold a majority, at most one side stays active and the minority side steps down.

Why even node counts hurt

A cluster of four can split two and two with no majority, so nobody leads. Odd numbers like three or five avoid this. A lightweight witness or tiebreaker node can give an even cluster a deciding vote.

Belt and suspenders

Quorum prevents two leaders accepting writes, but a slow old leader might still try. Fencing tokens stop its late writes at the storage layer, and STONITH style fencing physically powers off the stale node.

Key idea

Split brain is prevented by requiring a majority quorum to lead so a partition can leave at most one active leader, backed by fencing against stragglers.

Check yourself

Answer to earn rating on the learn ladder.

1. How does a majority quorum prevent split brain?

2. Why are odd cluster sizes preferred?

3. What guards against a stale leader that still tries to write?