Communication among Raft Nodes
Let's explore how Raft nodes communicate, what problem occurs, and how Raft solves this problem.
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 has been reached on this entry.
As mentioned previously, leaders are responsible for receiving commands from clients and replicating ...