Skip to content

chickenchickenlove/implement_raft_consensus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 

Repository files navigation

Study Level RAFT Consensus algorithm with erlang

This code is an implementation of the RAFT consensus algorithm written for learning purposes. A single erlang actor process represents a single RAFT node. So, If you want to create a RAFT cluster with 5 nodes, you need to spawn 5 erlang actor processes.

In this code, each RAFT node communicates with other nodes via erlang message passing. This means that no TCP connection is involved.

This RAFT implementation supports this features below.

  • RAFT Basic.
    • Log Replication (Append Entries RPC)
    • Leader Election (Request Vote RPC)
  • RAFT Advanced
    • Joint Consensus.
    • Log Compaction.
    • Install Snapshot.

Reference

How to Test

  • There are 110 test cases. some test cases may be flaky sometimes.
  • Test cases in eunit can cover this action
    • RAFT basic.
    • Split Brain
    • Split Vote
    • Joint Consensus
    • Log Compaction
    • Install Snapshot
$ rebar3 eunit
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling raft_erlang_implementation
===> Performing EUnit tests...
..................................................................................................
Finished in 29.611 seconds
110 tests, 0 failures

About

implement_raft_consensus

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages