The Desi Architect
Notes / Docker Sandboxes / Raft Consensus Algorithm: Leader Election & Log Replication
Docker Sandboxes · Tier 4: Architect & Chaos · Lab 52

Raft Consensus Algorithm: Leader Election & Log Replication

Deploy a 3-node etcd cluster to master the Raft distributed consensus algorithm. Observe automated leader elections, majority quorum formation, log replication across nodes, negative control write stalls in minority network partitions, and seamless log catch-up upon node recovery.

Time30 minutes
Stacketcd 3.5Ports 12379, 12380, 12381
MemoryAbout 120 MB
Before thisLab 51Redis Sentinel Quorum Failover and
Verified runWindows, Mac, LinuxBash and PowerShell
  1. 1PrepareWhat you will learn
  2. 2PredictGuess before you run
  3. 3RunStep by step
  4. 4ObserveWhat you should see
  5. 5Break itChange one thing
  6. 6Clean upLeave nothing running
On this page
  1. 00 / What You Will Learn
  2. 01 / Why It Matters
  3. 02 / What We Are Building
  4. 03 / Words You Need
  5. 04 / Predict First
  6. 05 / Step by Step
  7. 06 / What You Should See
  8. 07 / Look Inside
  9. 08 / Break It, Fix It
  10. 09 / In Real Projects
  11. 10 / Interview Corner
  12. 11 / Clean Up

00 /What You Will Learn

By the end you will be able to
  • Understand how the Raft consensus algorithm guarantees safety and prevents split-brain anomalies.
  • Calculate majority quorum requirements (Q = floor(N / 2) + 1) for distributed clusters.
  • Replicate log proposals across multiple nodes and verify linearizable read consistency.
  • Reproduce the minority network partition failure where writes stall without a quorum.
  • Observe automated leader election timeouts and monotonic Raft term increments.
  • Verify log catch-up mechanics when an isolated follower reconnects to the active cluster.

Before you start

Finish Lab 23 (PostgreSQL Replication Lag & Read Replicas) and Lab 51 (Redis Sentinel Automated Failover) first. You should understand primary-replica replication, network latency, and why single points of failure require automated failover. Docker Desktop must be running.