The Raft Consensus Algorithm

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 is 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.


This is "the Raft paper", which 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.

More Raft-related papers:


These talks serve as good introductions to Raft:

Courses teaching Raft

This is a list of courses that include lectures or programming assignments on Raft. This might be useful for other instructors and for online learners looking for materials. If you know of additional courses, please submit a pull request or an issue to update it.

Where can I ask questions?

The best place to ask questions about Raft and its implementations is the raft-dev Google group. Some of the implementations also have their own mailing lists; check their READMEs.

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 submit a pull request or an issue 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 Yes Yes No 2016-01-28
NRaft Bert Willems (Premotion) C# MIT 2013-09-02
jraft Andy Chen Java Apache2 Yes Yes Yes 2016-04-14
dupdob/RAFTiNG Cyrille Dupuydauby C# Apache2 2013-09-02
cppa-raft Zhang Yichao C++ MIT Partial No No 2014-02-04
Kudu David Alves, Todd Lipcon, Mike Percy C++ Apache2 Yes Yes Yes 2016-06-02
LogCabin Diego Ongaro (Stanford) C++ ISC Yes Yes Yes 2013-10-23
RethinkDB/clustering C++ AGPL Yes Yes Yes 2015-09-15
dinghy Trevor Bernard (UserEvents) Clojure Apache2 2013-11-13
meatcompute/raft-consensus Mikaela Patella Clojure Eclipse 2016-06-02
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
verdi-raft James Wilcox, Doug Woos, Pavel Panchekha, Zach Tatlock, Xi Wang, Mike Ernst, and Tom Anderson (University of Washington) Coq BSD Yes No No 2016-10-12
draft Patrick Van Stee Elixir 2013-06-20
rafute Yuki Ito Elixir MIT Yes No No 2016-04-03
Raft-php Waqee Khalid PHP MIT Yes No No 2016-06-01
zraft_lib Gunin Alexander Erlang Apache2 yes yes yes 2015-05-31
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
fsraft Karl-Johan Nilsson F# public domain 2016-06-02
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
Juno (BFT variant of Raft) Brian Schroeder, Libby Kent, Stuart Popejoy, Will Martino. Haskell BSD 2016-06-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 GPL3 2017-02-02
Ratis Java Apache2 2017-02-02
bakwc/PySyncObj Filipp Ozinov Python MIT Yes Yes Yes 2016-07-25
raftos Alexander Zhebrak Python MIT Yes No No 2016-11-10
Gondola Patrick Chan, Wei-Cheng Pan Java New BSD Yes Yes In progress 2015-11-19
jalvaro/raft Jordi Alvaro Java 2014-02-04
jgroups-raft Bela Ban Java Apache2 Yes Yes Yes 2015-05-15
RaftKVDatabase/JSimpleDB Archie Cobbs Java Apache 2.0 Yes Yes Yes 2015-06-10
OpenDaylight Moiz Raja, Kamal Rameshan, Robert Varga (Cisco), Tom Pantelis (Brocade) Java Eclipse Yes No Yes 2015-03-23
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
tetrapods/raft Aaron Davidson Java Apache2 Yes Yes 2015-09-15
liferaft Arnout Kazemier Javascript MIT 2014-11-13
benbjohnson/raft.js Ben Johnson (Sky) Javascript MIT 2013-09-02
gaggle Ben Ng Javascript MIT Yes Partial No 2016-01-16
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
aioraft lisael Python AGPL Lacking persistence Yes No 2015-07-24
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
mruby-flotte Hendrik mruby Apache2 Yes No No 2016-01-03
zodiac-prime Evan Phoenix (LivingSocial) Ruby MIT 2013-09-02
hoverbear/raft Andrew Hobden, Dan Burkert Rust MIT Yes 2015-07-31
TiKV Jay, ngaut, siddontang, tiancaiamao. Rust Apache2 Yes Yes Yes 2016-06-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
chelan Eric Jutrzenka Scala Yes No No 2015-04-15
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 2015-11-12
C5 replicator Ryan Rawson, Alex Newman, and Josh Greenberg Java Apache2 Yes Yes Yes 2014-09-23
yora Huy Le Ruby MIT Yes Yes 2015-01-05
srned/Prez Sureshkumar Nedunchezhian C BSD Yes No No 2015-01-23
fxsjy/Ins Junyi Sun C++ BSD Yes No Yes 2015-06-18
Cornerstone Andy Chen C++ Apache2 Yes Yes Yes 2016-06-10
Chillaxd Yassine Lamgarchal Python Apache2 Yes No No 2015-05-02