Skip to content

happybear-21/eliraft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Eliraft

Eliraft is an implementation of the Raft consensus algorithm in Elixir.

Prerequisites

  • Elixir (version 1.18 or later)
  • Erlang/OTP (compatible with your Elixir version)

Getting Started

1. Clone the Repository

git clone https://github.com/happybear-21/eliraft.git
cd eliraft

2. Install Dependencies

Fetch and install all dependencies:

mix deps.get

3. Compile the Project

Compile the source code:

mix compile

4. Run the Server

You can run the application in two ways:

a) Interactive Mode (Recommended for Development)

Start an interactive Elixir shell with your application running:

iex -S mix

b) Non-Interactive Mode

Run the application without an interactive shell:

mix run --no-halt

5. Interacting with the Raft Server

Once the application is running (especially in IEx), you can interact with the Raft server:

# Check the status of the server
Eliraft.Server.status(:eliraft_table_1)

# Check the membership
Eliraft.Server.membership(:eliraft_table_1)

You can also start an acceptor and perform commit/read operations:

{:ok, acceptor} = Eliraft.Acceptor.start_link(name: :test_acceptor, server: :eliraft_table_1)
Eliraft.Acceptor.commit(acceptor, {:set, "key", "value"})
Eliraft.Acceptor.read(acceptor, {:get, "key"})

Features

Feature Status Notes
Leader Election + Log Replication ✅ Implemented Basic leader election and log replication are implemented with tests. Includes term management, vote handling, and log consistency checks.
Persistence 🟡 Partial Basic log persistence is implemented, but lacks disk-based persistence and crash recovery.
Membership Changes 🟡 Partial Basic membership management is implemented in Config module, but lacks dynamic cluster reconfiguration.
Log Compaction ❌ Not Implemented No implementation of log compaction or snapshot mechanism.

Development

  • To run tests:
    mix test
  • To generate documentation:
    mix docs

License

GPL-3.0 license

About

Elixir Implementation of the Raft Consensus Algorithm

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages