Raft explained in plain terms means understanding the algorithm that lets a group of servers agree on the same data, even when some of them fail. The central question is how several machines, each with its own copy of the data, can stay in step when the network drops messages and servers crash, and the answer is to elect one leader, and let only the leader decide what gets written.
Raft is a consensus algorithm, which means it is a set of rules that lets a distributed system agree on a single sequence of changes. It was designed in 2013 by Diego Ongaro and John Ousterhout as a clearer alternative to Paxos, the older consensus algorithm, and it is the algorithm behind etcd, the store Kubernetes uses, and Consul, the service discovery tool.
The idea is simple: one leader, many followers, and a shared log. The leader receives every change, writes it to its log, copies it to the followers, and only counts it as committed once a majority have stored it, so that the change survives even if some servers fail afterwards. This article explains what Raft is, how it works, and where it is used.
Key takeaways
- Raft lets a group of servers agree on one shared log of changes.
- One elected leader receives writes and copies them to followers.
- A change is committed only once a majority of servers have stored it.
- If the leader fails, the followers elect a new one and carry on.
- It is the consensus algorithm behind etcd and Consul.
What Raft is
Raft solves the problem of keeping replicated state machines in agreement. A replicated state machine is a group of servers that each hold the same data and apply the same sequence of changes to it, so that any of them can answer a question with the same result. The hard part is agreeing on that sequence when servers can crash and messages can be lost, and that is exactly what Raft provides.
The algorithm divides the problem into three parts that are easier to reason about separately. Leader election chooses one server to be in charge, log replication copies the leader’s decisions to the followers, and safety rules make sure that a new leader can never undo a change that was already committed. Each part is simple on its own, and together they give the system its guarantees.
Raft was designed to be understandable, which is its great advantage over Paxos. Paxos is famously hard to implement correctly, and its descriptions are difficult to follow, while Raft’s authors deliberately structured it around the way a real system works, with a leader, terms, and a log, so that an engineer can read the paper and build it. Our guide to etcd explains the key-value store that uses Raft to hold Kubernetes state, and our guide to Consul explains the service discovery tool that uses Raft for its shared register.
How Raft works
Time in Raft is divided into terms, numbered one after another, and each term begins with an election. A server that has not heard from a leader starts an election by voting for itself, asking the others for their votes, and becoming leader if it wins a majority. The majority rule is the key: only one candidate can win a majority in any term, so there can never be two leaders at once.
Once elected, the leader serves client requests by appending each change to its own log as a new entry, then sending the entry to the followers. A follower that receives the entry stores it and replies, and once a majority have stored it, the leader marks it committed and tells the followers, who then apply it to their own copy of the data. The leader also sends regular heartbeats, so the followers know it is still alive and do not start an election.
If the leader fails, the followers notice the missing heartbeats, and after a random delay one of them starts an election for the next term. The random delay matters, because it stops all the followers from starting elections at once and splitting the vote. The new leader is chosen from the servers whose logs are most up to date, which is enforced by a rule that a voter only votes for a candidate whose log is at least as complete as its own.
When a new leader takes over, its log may differ from some followers, because it may hold entries they do not have, or lack entries they do. Raft resolves this by a simple rule: the leader’s log is always treated as correct, and followers delete any entries that conflict with it, then copy the leader’s entries until their logs match. That is how the system recovers from crashes without ever losing a committed change.
Raft assumes servers fail by stopping, not by lying. A server that crashes simply stops answering, and the majority carries on, but a server that sends wrong answers on purpose is outside the model, and handling that needs a different class of algorithm, called Byzantine fault tolerance. For the clusters Raft is used in, where the servers are run by one organisation, stopping is the failure that matters.

Comparing Raft with other consensus methods
Raft is one of several ways for servers to agree, and each suits a different need. Paxos is the older, more general algorithm, gossip spreads state quickly without agreement, and a single database with no replication needs no consensus at all, but each has its own trade-offs.
The table below sets out the main contrasts between the leading approaches.
| Aspect | Raft | Paxos | Gossip |
|---|---|---|---|
| Purpose | Leader election and log replication | Consensus on values | Spreading state quickly |
| Leader | One elected leader | Proposers, no fixed leader | No leader |
| Understandability | Designed to be clear | Famously hard to follow | Simple, best effort |
| Guarantees | Strong consistency | Strong consistency | Eventual consistency |
| Best for | Cluster state, etcd and Consul | Theoretical consensus | Membership and failure detection |
The practical result is that Raft is the right choice for cluster state that must stay consistent, Paxos remains the reference for consensus theory, and gossip is the choice when spreading news quickly matters more than agreeing exactly.
Where Raft is used
Kubernetes is the largest use. etcd, the store that holds all of Kubernetes state, runs Raft across three or five servers, and every change to the cluster, from a new deployment to a scaled service, is a Raft log entry, which is why a Kubernetes control plane survives the loss of a server without losing track of anything.
Service discovery uses Raft to hold its shared register. Consul’s servers run Raft to agree on which services exist, where they are, and whether they are healthy, so that every agent in the system sees the same directory, even as services come and go by the minute.
Distributed databases use Raft to replicate their data. Systems such as CockroachDB and TiDB divide their data into ranges, run a Raft group for each range, and let each group elect its own leader, which spreads the work across the cluster while keeping every range consistent.
Message queues and streaming systems use Raft for their metadata. A queue’s topics, partitions, and consumer offsets are cluster state that must survive failures, and Raft provides the agreement that lets the system rebuild its view of the world after a crash.
Configuration management uses Raft to hold shared settings. When an operator changes a value, the change is written through Raft, committed by a majority, and then visible to every service at once, which is why a configuration update reaches the whole system without a restart.
Strengths and limits
The greatest strength of Raft is that it is understandable. An engineer can read the algorithm, follow its rules, and implement it correctly, which is a real advantage over Paxos, where subtle mistakes are common and hard to find. That understandability is why Raft has become the default consensus algorithm in new systems.
It is also a strength that Raft is practical. It handles leader failure automatically, it recovers by copying logs, and it gives strong guarantees with a simple majority rule, which means a cluster of three servers survives one failure, and a cluster of five survives two, with no operator intervention.
The limits are real, though. Raft needs a majority to make progress, so a cluster that loses too many servers stops accepting writes until they return, and it assumes servers fail by stopping, not by lying, which means it cannot protect against a compromised server. It is also a poor fit for systems with thousands of members, where gossip scales better.
Raft checklist
- Run three or five servers, on separate machines and racks.
- Use fast disks, since every write waits for the log to be stored.
- Keep election timeouts randomised, so votes do not split.
- Monitor leader changes, since frequent elections mean trouble.
- Back up the log regularly, and test restoring from a backup.
- Never run two servers on the same machine in production.
- Watch the commit lag, since a slow follower slows every write.
- Plan for the loss of a minority, and test it by stopping a server.
- Document which data Raft holds, and what happens if it is lost.
Frequently asked questions
What is Raft in simple terms?
Raft is a set of rules that lets a group of servers agree on the same data. They elect a leader, the leader writes every change to a log and copies it to the followers, and a change counts once a majority have stored it.
What is a term in Raft?
A term is a numbered period of time, and each term begins with an election. Terms act as a logical clock: a server in a higher term is more up to date, and an old leader from a lower term is ignored, which stops stale leaders from causing trouble.
What happens when the leader fails?
The followers notice the missing heartbeats, and after a random delay one of them starts an election for the next term. The winner becomes the new leader, forces the followers’ logs to match its own, and the system carries on.
What is the difference between Raft and Paxos?
They solve the same problem, but Raft was designed to be understandable, with a leader, terms, and a log, while Paxos is more general and famously hard to implement correctly. Most new systems choose Raft for that reason.
Why does Raft need a majority?
Because a majority guarantees that any two majorities overlap, so a new leader always includes at least one server that holds every committed change. That overlap is what stops a committed change from ever being lost.
Can Raft handle a server that lies?
No. Raft assumes servers fail by stopping, not by sending wrong answers. Handling lying servers needs Byzantine fault tolerance, a different and much more expensive class of algorithm.
The bottom line
Raft explained in one line is this: servers elect a leader, the leader writes every change to a log and copies it to the followers, and a change counts once a majority have stored it.
It is the consensus algorithm that made strong consistency practical, and it sits quietly at the heart of Kubernetes, Consul, and the databases that hold the state of the modern cloud.
This article is general information about how Raft works, not advice about designing consensus for a particular system.







