raft-from-scratch
From scratch implementation of the Raft consensus algorithm for distributed systems
What is Raft ?
Make sure to read the Raft research paper https://raft.github.io/raft.pdf
The Raft algorithm is a distributed consensus algorithm designed for replicating transaction logs in distributed systems. It has been proposed as a simpler alternative to the Paxos algorithm, with an emphasis on understandability and ease of implementation.
Distributed consensus is a fundamental problem in computer science where a set of nodes must reach agreement on a common state despite the possibility of network failures and disruptions. The Raft algorithm solves this problem by using an elected leader to coordinate replication operations.
The main idea of the Raft algorithm is to divide the system into three distinct roles: the leader, the followers and the candidates. The leader is responsible for receiving client requests, replicating them to followers and ensuring that followers stay in sync. If the leader becomes unavailable, a new leader is elected from the candidates.
Raft uses a transaction log mechanism to ensure that replicated data is consistent. Each node maintains a log of its transactions, and these logs are replicated and ordered consistently across nodes in the system.
The Raft algorithm is designed to be more understandable and easier to implement than the Paxos algorithm, making it easier to use in distributed systems. It is used in many real-world distributed systems, such as distributed databases, distributed storage systems and distributed file systems.
Source :