Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 11 · From Scratch · Raft · with code: Go · about 11 min to read

Play it as a journeyTutor comes with a plan

Build Your Own Raft

Consistency and Consensus
Consistency and Consensus · Open board

The board that names what a group of machines can still promise each other when the network cannot be trusted. This build is the working program behind its “vote underneath” half. Sits at the head of the Raft series, after the Distributed Scheduler build.

Before you start. This series builds a small copy of a consensus system: a group of five programs that keep one identical list of commands, even when some of them crash or lose contact with the rest. You do not need to have read a consensus paper. You do need two ideas from earlier lessons. Who holds the pen (consensus & Raft) explains why one machine at a time should be allowed to write, and Consistency and Consensus gives the guarantee a group of machines can offer in return. Scheduler 04: Leader Election shows what a project does when it leans on such a group without building one. The build format is the one from Build Your Own Database, From Scratch: one Go module, one directory per stage, and a test next to every stage.

Lesson 77 of 117 in From Scratch

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • June 2014, Philadelphia: a paper that admits it is about teaching
  • The problem Raft solves, in one picture
  • The map
  • The module and its stages
  • A deterministic world, on purpose
  • Running all four stages
  • What this build leaves out

Terms it explains: replicated log, replicated state machine, 2PC, causal consistency, consensus, coordination service, coordinator/participant, FLP, Lamport timestamp, linearizability, partial vs total order, Paxos/Raft/Zab, strict serializability, total order broadcast.

Related papers

Review From Scratch