Raft's Basics and High-Level Workflow

Learn about the basics of the Raft consensus algorithm and review its high-level workflow.

Raft basics

This lesson will cover the building blocks of a Raft consensus algorithm: the server roles used in the algorithm, how Raft handles the elections and terms, and what types of Remote Procedure Calls (RPCs) it uses to achieve its functionality.

Server states

A Raft cluster operates with a minimum of N/2+1N/2 +1 votes in favor of a specific server, where NN is the total number of members in the cluster. For example, if there are 5 servers in the cluster, it would need 3 servers to form a quorumA majority of members from a peer set.. At any given time, each server is in either of the three states:

  1. Leader: In normal operations, one leader handles and processes all the client requests.
  2. Follower: All the other servers besides the leader are followers. The followers are passive; they issue no requests on their own but follow directions from the leader and respond to the instructions sent by the leader and the candidates.
  3. Candidate: A server transitions from the follower to the candidate state when it initiates a new electionThe process of electing a new leader for a given term..

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.