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
Qihoo360/raft ZongzhiChen, AnAnZhaoKangWang C++ GPL3 Yes No No 2017-06-12
Zatt Simon Accascina Python AGPL Yes Yes Yes 2017-06-29
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 Yes 2018-01-08
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
RaftCore Guillermo Rodríguez C# MIT Yes 2018-06-13
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
dragonboat Lei Ni Go Apache2 Yes Yes Yes 2019-02-10
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
Permazen/RaftKVDatabase Archie Cobbs Java Apache2 Yes Yes Yes 2017-10-17
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
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
huntlabs/hunt-raft huntlabs D Apache2 Yes Yes Yes 2018-12-05
viile/raft viile D MIT Yes No No 2017-03-03
d-raft Dengos Wei C++ Apache2 Yes No No 2017-06-10
raft-angular Dushyant Sabharwal Angular 4 MIT Yes Yes No 2017-06-22
raft-java Wenwei Hu Java Apache2 Yes Yes Yes 2017-09-19
ScaleCube Raft Leader Election ScaleCube Java Apache 2.0 Yes No No 2017-10-26
Ra Team RabbitMQ erlang ASL2 / MPL1.1 Yes Yes Yes (with modifications) 2017-12-07
RaftShop Matteo Berti, Arnaldo Cesco , Salvatore Fiorilla Jolie LGPL Yes 2018-01-08
braft Zhangyi Chen, Yao Wang C++ Apache 2.0 Yes Yes Yes 2018-02-08
xingyif/raft Yifan Xing Python Apache 2.0 Yes Yes Yes 2018-06-30
xraft XnnYygn Java MIT Yes Yes Yes 2018-08-26
RSM Olivier Paugam Rust MIT Yes Soon Yes 2018-09-17
Riff Aaron Pritzlaff Scala Apache2 Yes Yes Yes 2018-09-27
Theseus Eloquent Labs (Keenon Werling, Gabor Angeli, et al.) Java MIT Yes Yes Yes 2018-10-15
raft-kotlin Sasha Chepurnoi Kotlin MIT Yes Yes No 2019-04-06
hazelcast-raft Mehmet Dogan, Ensar Basri Kahveci Java Apache 2.0 Yes Yes Yes 2019-04-04
SOFAJRaft Boyan, Jiachun. Java Apache2.0 Yes Yes Yes 2019-03-22
IvanProdaiko94/raft-protocol-implementation Ivan Prodaiko Go MIT Yes No No 2019-06-
.NEXT Raft Roman Sakno C# MIT Yes Yes No but can be enabled if third-party log is supplied 2019-07-21
dataleading/easyRaft Shanliang Shen Java Apache2.0 Yes No In Progress 2019-07-10
Vesper Nicola Manzini, Peng Ding. Python MIT Yes Yes No 2019-08-14
canonical/raft Free Ekanayaka (Canonical) C Apache2.0 Yes Yes Yes 2019-08-19
Rub-Raft zhyzhyzhy Java Apache2.0 Yes Yes Yes 2019-08-24
NuRaft Jung-Sang Ahn (eBay) C++ Apache2.0 Yes Yes Yes 2019-09-11