Communication among Raft Nodes
Explore how Raft nodes use two main RPCs, RequestVote and AppendEntries, to replicate logs and achieve consensus in distributed systems. Learn the process for committing entries, managing leader and follower failures, and resolving log divergences to ensure consistent state machines across a cluster.
Communication mechanism
Nodes communicate via remote procedure calls (RPCs) and Raft has two basic RPC types:
- RequestVote: Sent by candidates during an election
- AppendEntries: Sent by leaders to replicate log entries and provide a heartbeat form
The commands are stored in a log replicated to all the nodes of the cluster.
The log entries are numbered sequentially, and they contain the term in which they were created and the associated command for the state machine, as shown in the following illustration.
An entry is considered committed if it can be applied to the state machine of the nodes. Raft guarantees that committed entries are durable and will eventually be executed by all of the available state machines, while also guaranteeing that no other entry will be committed for the same index. It also guarantees that all the preceding entries of a committed entry are also committed. This status essentially signals that consensus ...