← All tutorials

Skill Zuno · skillzunos.com · System Design

Leader Election tutorial

Learn Leader Election on Skill Zuno. This Leader Election tutorial covers New, Easy, Medium, Hard, and Diff levels so you can study practical Leader Election problems on skillzunos.com.

Open Leader Election on Skill Zuno

Also see the Leader Election interview questions.

Leader election chooses one node in a cluster to coordinate work, such as accepting writes or running scheduled jobs, so that nodes do not conflict. It must cope with crashes, slow nodes and network partitions without ever producing two leaders at once. Interviews cover why leaders are needed, Raft and Paxos, leases, fencing tokens and tools such as ZooKeeper and etcd.

Leader Election topics covered

  • Why systems need a leader — Ordering writes, avoiding duplicate work and simplifying coordination.
  • Split brain — How network partitions can create two leaders, and why majorities prevent it.
  • The Raft consensus algorithm — Terms, votes, heartbeats and log replication in an understandable consensus protocol.
  • Paxos — The original consensus protocol and how it relates to Raft.
  • Leases and fencing tokens — Time-limited leadership and how increasing tokens stop an old leader from causing damage.
  • Coordination services — Using ZooKeeper, etcd or Consul instead of writing consensus yourself.

What you can learn

  • Leader Election tutorial for beginners and experienced developers
  • Level-based practice: New, Easy, Medium, Hard, and Diff
  • System Design topics alongside Leader Election on skillzunos.com

More System Design tutorials

All tutorials