Try
↑ ↓ move↵ openesc close
In this lesson · topic 3 of 7
  1. 1. Agreeing when nodes fail
  2. 2. Elections, terms and the log
  3. 3. Crash the leader and cut the cluster
  4. 4. The leader nobody follows
  5. 5. Walking a follower's log back to the leader's
  6. 6. Adding two nodes without ever having two majorities
  7. 7. Check votes, logs and quorums

Topic 3

Crash the leader and cut the cluster

8 min read

The cluster

Each card is a node: its role, its term, who it voted for, and its log as a row of cells. A solid cell is committed, a dashed one is in the log but not yet committed, and the colour of a cell’s edge is the term it was written in. The event list says what just happened in plain words. Writes arrive on their own every half second, and the button sends one more.

Predict before you press play

You crash the leader. What do you expect to see first?
Crash or restart any node on its card.

term 0leader nonecommitted 0 entriesmajority 3 of 50 messages in flight

n0 followerterm 0

voted nobody, timer 360 ms

  1. empty log
commit 0 / 0
n1 followerterm 0

voted nobody, timer 480 ms

  1. empty log
commit 0 / 0
n2 followerterm 0

voted nobody, timer 470 ms

  1. empty log
commit 0 / 0
n3 followerterm 0

voted nobody, timer 580 ms

  1. empty log
commit 0 / 0
n4 followerterm 0

voted nobody, timer 390 ms

  1. empty log
commit 0 / 0

Solid cell: committed. Dashed: in the log but not committed. Colour of the border: the term the entry was written in. Grey card: cut off by the partition.

elections
0
split votes
0
writes committed
0 / 0
writes with no leader
0

What just happened

Waiting for the first election timeout.

Committed entries and term over time

Waiting for data. Press play or step the simulation.

Full-page version with guided experiments: Raft consensus lab.

Things to try

  1. Press Crash on the leader. Watch the term go up and a new leader appear. Restart the old node and watch it take the new leader’s log.
  2. Press Cut the leader into a minority. Submit a few writes. The cut-off leader’s new cells stay dashed. The other side elects a new leader and its cells turn solid.
  3. Press Heal the network. The old leader steps down, its dashed cells are deleted, and every log ends up identical.
  4. Set the election timeout to 150 ms and the network delay to 100 ms. Crash the leader a few times and watch the split vote counter.
  5. Crash three of five nodes. There is no leader and nothing commits, however long you wait. Restart one and the cluster recovers.

The full-page lab has five guided experiments with one-click setups.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms