Try
↑ ↓ move↵ openesc close

Curriculum · Module 05, Consensus and Coordination

Lesson 2 · 7 topics · 44 min · Intermediate · 0/7 done

Raft consensus

Elections, terms, log replication and the commit rule. Watch a cluster keep one consistent log through crashes and partitions.

What each topic covers

  • A replicated log needs every node to apply the same entries in the same order, through crashes, partitions and nodes that only think they are in charge.
  • How a follower becomes a leader, how a write becomes committed, and the three rules that keep every log the same.
  • Crash nodes, cut the network, submit writes, and watch terms, votes and commit indexes hold the log together.
  • Measured elections and partitions, the split-vote cost of tight timeouts, and what the model leaves out.
  • A worked repair of a follower that holds the wrong entries, the AppendEntries back-off step by step, and why the old-term commit rule exists.
  • Why swapping the whole configuration at once can elect two leaders, how joint consensus and one-at-a-time changes avoid it, and why new servers join as learners.
  • Three quick checks on one leader per term, the election restriction and a cluster without a majority, plus the papers behind the lesson.

Topics

  1. 1Agreeing when nodes fail5 min
  2. 2Elections, terms and the log8 min
  3. 3Crash the leader and cut the cluster8 min
  4. 4The leader nobody follows5 min
  5. 5Walking a follower's log back to the leader's7 min
  6. 6Adding two nodes without ever having two majorities7 min
  7. 7Check votes, logs and quorums4 min

Practise this lesson

13 interview questions on raft and consensus, with worked answers and sources.

Practise these

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