Consensus algorithm RAFT

Consensus algorithms are a mechanism that allows a cluster of many computers (servers) to operate coherently and smoothly, even though some of them are disconnected from the cluster. Therefore, consensus algorithms have always played an important role in building reliable large-scale computing systems.

Where Raft is a relatively efficient consensus algorithm that has significant advantages over other consensus algorithms, it has three important characteristics:

Stronger Leader (stronger Leader role): Raft allows the Leader to have a stronger position than other consensus algorithms. For example, log entries are only broadcast from the Leader to other servers. This simplifies the management of replicating log entries between servers and makes Raft easier to understand (compared to Leslie Lamport's Paxos algorithm).

Leader Election: Raft uses a random timer to elect a leader, adding a small change to heartbeats compared to other consensus algorithms. However, it helps to quickly resolve conflicts between servers in the cluster simply and promptly.

Membership changes (change the role of the server in the cluster): i.e., change the role of a specific server from follower to the leader and vice versa, the mechanism that Raft uses for this change is to use a consensus method In the new joint consensus, during this change the role of a server will be the overlap between leader and follower. This allows the cluster to continue to function normally while the servers in the cluster are changing roles.

Therefore, it will run n ≥ 2f + 1, where f is the maximum number of nodes that can fail and n is the total number. The Raft protocol first selects a leader from among a set of nodes. It then makes the leader take full responsibility for receiving transaction requests and handling log replication (i.e., blocks) on other nodes.

Each node can be a candidate, a follower, or a leader. The leader selection procedure is deterministic, so the protocol cannot run until the leader is chosen by more than half of the nodes.

Last updated