Raft Consensus
1 min read
Pronunciation
[raft kon-sen-suhs]
Analogy
Raft is like having a foreman (leader) who collects work reports from team members (followers) and ensures everyone’s log of tasks is identical.
Definition
A leader‑based consensus algorithm for managing a replicated log, designed for understandability and practical implementation in distributed systems.
Key Points Intro
Raft ensures consistency through these mechanisms:
Key Points
Leader election: Followers elect a leader via randomized timeouts.
Log replication: Leader appends entries and replicates to followers.
Safety: Only leader with up‑to‑date log can commit entries.
Membership changes: Supports dynamic cluster reconfiguration.
Example
etcd uses Raft to replicate configuration data across a cluster of servers, ensuring all nodes apply changes in the same order.
Technical Deep Dive
Raft divides time into terms. On timeout, a follower becomes candidate, requests votes via RequestVote RPC. Elected leader issues AppendEntries RPCs to replicate log entries and heartbeats. Commit index advances when a majority acknowledges an entry. Configuration changes use joint consensus to avoid split-brain.
Security Warning
A malicious leader can withhold entries; use monitoring to detect unresponsive leaders and trigger new elections.
Caveat
Raft tolerates only crash faults, not Byzantine behavior.
Raft Consensus - Related Articles
No related articles for this term.