What is Raft?

Raft is a consensus algorithm that is designed to be easy to understand. It's equivalent to Paxos in fault-tolerance and performance. The difference is that it's decomposed into relatively independent subproblems, and it cleanly addresses all major pieces needed for practical systems. We hope Raft will make consensus available to a wider audience, and that this wider audience will be able to develop a variety of higher quality consensus-based systems than are available today.

Hold on—what is consensus?

Consensus is a fundamental problem in fault-tolerant distributed systems. Consensus involves multiple servers agreeing on values. Once they reach a decision on a value, that decision is final. Typical consensus algorithms make progress when any majority of their servers are available; for example, a cluster of 5 servers can continue to operate even if 2 servers fail. If more servers fail, they stop making progress (but will never return an incorrect result).

Consensus typically arises in the context of replicated state machines, a general approach to building fault-tolerant systems. Each server has a state machine and a log. The state machine is the component that we want to make fault-tolerant, such as a hash table. It will appear to clients that they are interacting with a single, reliable state machine, even if a minority of the servers in the cluster fail. Each state machine takes as input commands from its log. In our hash table example, the log would include commands like set x to 3. A consensus algorithm is used to agree on the commands in the servers' logs. The consensus algorithm must ensure that if any state machine applies set x to 3 as the nth command, no other state machine will ever apply a different nth command. As a result, each state machine processes the same series of commands and thus produces the same series of results and arrives at the same series of states.

Raft Visualization

Here's a Raft cluster running in your browser. You can interact with it to see Raft in action. Five servers are shown on the left, and their logs are shown on the right. We hope to create a screencast soon to explain what's going on. This visualization (RaftScope) is still pretty rough around the edges; pull requests would be very welcome.

The Secret Lives of Data is a different visualization of Raft. It's more guided and less interactive, so it may be a gentler starting point.

Where can I learn more?

The paper describes Raft in detail: In Search of an Understandable Consensus Algorithm (Extended Version) by Diego Ongaro and John Ousterhout. A slightly shorter version of this paper received a Best Paper Award at the 2014 USENIX Annual Technical Conference.

Diego Ongaro's Ph.D. dissertation expands on the content of the paper in much more detail, and it includes a simpler cluster membership change algorithm.

These talks also serve as good introductions to Raft:

Where can I ask questions?

The best place to ask questions about Raft and its implementations is the raft-dev Google group.

Where can I get Raft?

There are many implementations of Raft available in various stages of development. This table lists the implementations we know about with source code available. The most popular and/or recently updated implementations are towards the top. This information will inevitably get out of date; please send us a bug report or pull request to update it.

Name Primary Authors Language License Leader Election + Log Replication? Membership Changes? Log Compaction? Row Last Updated
bspolley/raft Alex Kaiser, Brennan Polley, Helen Weng (Berkeley) Bloom Some 2013-05-18
noeleo/raft Noel Moldvai, Rohit Turumella, Josh Muhlfelder, James Butkovic (Berkeley) Bloom Simplified BSD Lacking persistence No No 2013-05-25
whitewater Adam Midvidy, Anh Mai, Karoun Kasraie, Sanketh Katta (Berkeley) Bloom MIT Some correctness issues No No 2013-05-18
willemt/raft Willem-Hendrik Thiart C BSD 2013-11-13
NRaft Bert Willems (Premotion) C# MIT 2013-09-02
dupdob/RAFTiNG Cyrille Dupuydauby C# Apache2 2013-09-02
cppa-raft Zhang Yichao C++ MIT Partial No No 2014-02-04
LogCabin Diego Ongaro (Stanford) C++ ISC Yes Yes Yes 2013-10-23
dinghy Trevor Bernard (UserEvents) Clojure Apache2 2013-11-13
melee Fredrick Galoso Clojure Eclipse 2014-03-02
raft-clj John Weaver Clojure Eclipse 2013-06-20
rodriguezvalencia/rafting Sergio Rodriguez Clojure MIT Partial No No 2014-02-04
draft Patrick Van Stee Elixir 2013-06-20
eraft Uwe Dauernheim Erlang 2013-05-18
huckleberry Jakob Sievers Erlang 2013-05-18
rafter Andrew Stone (Basho) Erlang Apache2 2013-05-31
rafterl Eric Moritz Erlang 2013-05-25
Flotten Henrik Feldt (Jayway) F# MIT Some No No 2013-05-18
graft Ben Mills and William Dix (Braintree) Go Partial 2013-10-24
go-raft Ben Johnson (Sky) and Xiang Li (CMU, CoreOS) Go MIT Yes Partial? Yes 2013-07-05
etcd/raft Blake Mizerany, Xiang Li and Yicheng Qin Go Apache 2.0 Yes Yes Yes 2014-10-27
hashicorp/raft Armon Dadgar (hashicorp) Go MPL-2.0 Yes Yes Yes 2014-04-21
jpathy/raft Jiten Pathy Go WTFPL 2014-07-24
peterbourgon/raft Peter Bourgon (SoundCloud) Go Simplified BSD Yes Yes No 2013-07-05
pontoon Matt Reiferson Go 2013-09-02
seaturtles Lionel Barrow (Braintree) Go 2013-09-02
kontiki Nicolas Trangez Haskell BSD Some No No 2013-10-21
allengeorge/libraft Allen George Java BSD Yes No No 2013-12-09
barge Dave Rusek Java Apache2 Yes No No 2013-10-24
chicm/CmRaft Cheng Min Chi Java Apache2 Yes No No 2014-12-08
copycat Jordan Halterman Java Apache2 Yes Yes Yes 2014-02-04
drpicox/uoc-raft-2013p David Rodenas Java 2014-02-04
jalvaro/raft Jordi Alvaro Java 2014-02-04
pvilas/raft Pere Vilas Java 2013-11-13
Raft4WS Filipe Campos Java Apache2 Yes No No 2014-06-02
Raft-JVM Tim Kellogg (Alteryx) Java No No No 2013-09-04
r4j Kaarel Kann Java Apache2 Yes No No 2014-02-04
liferaft Arnout Kazemier Javascript MIT 2014-11-13
benbjohnson/raft.js Ben Johnson (Sky) Javascript MIT 2013-09-02
dannycoates/raft-core Danny Coates Javascript BSD 2014-02-04
kanaka/raft.js Joel Martin Javascript MPL-2.0 Yes Yes No 2013-09-16
skiff Pedro Teixeira Javascript ISC Yes Yes Yes 2014-10-24
ocaml-raft Heidi Howard (Cambridge) OCaml MIT Yes No No 2014-11-11
py-raft Toby Burress Python public domain Lacking persistence Yes No 2014-01-20
simpleRaft Sean Reed Python MIT 2013-11-13
floss Alexander Flatter Ruby MIT 2013-06-20
giraft Patrick Van Stee Ruby MIT 2013-11-13
harryw/raft Harry Wilkinson Ruby MIT 2013-06-20
zodiac-prime Evan Phoenix (LivingSocial) Ruby MIT 2013-09-02
akka-raft Konrad Malawski Scala Apache2 Yes Yes Yes 2014-02-09
archie/raft Marcus Ljungblad Scala Some No No 2013-11-13
cb372/raft Chris Birchall Scala 2013-11-13
ckite Pablo Medina Scala Apache2 Yes Yes Yes 2014-01-31
scalaraft Kim Je Min Scala Apache2 2014-02-04
lite-raft Luigi Tarenga Shell MIT Yes Yes Yes 2014-07-24
C5 replicator Ryan Rawson, Alex Newman, and Josh Greenberg Java Apache2 Yes Yes Yes 2014-09-23