When building a distributed system one principal goal is often to build in fault-tolerance. That is, if one particular node in a network goes down, or if there is a network partition, the entire cluster does not fall over. The cluster of nodes taking part in a distributed consensus protocol must come to agreement regarding values, and once that decision is reached, that choice is final.
Distributed Consensus Algorithms often take the form of a replicated state machine and log. Each state machine accepts inputs from its log, and represents the value(s) to be replicated, for example, a hash table. They allow a collection of machines to work as a coherent group that can survive the failures of some of its members.
Two well known Distributed Consensus Algorithms are Paxos and Raft. Paxos is used in systems like Chubby by Google, and Raft is used in things like tikv
or etcd
. Raft is generally seen as a more understandable and simpler to implement than Paxos.
To include this project as a dependency:
[dependencies]
raft = "0.1"
This crate is ready for production usage, but there are still several jobs need to be finished before reaching 1.0.
raft
is intended to track the latest stable
, though you'll need to use nightly
to simulate a full CI build with clippy
.
Using rustup
you can get started this way:
rustup override set stable
rustup toolchain install nightly
In order to have your PR merged running the following must finish without error:
cargo nightly test --features dev
You may optionally want to install cargo-check
to allow for automated rebuilding while editing:
cargo watch -s "cargo check --features dev"
Thanks etcd for providing the amazing Go implementation!
- TiKV, a distributed transactional key value database powered by Rust and Raft.