Eliraft is an implementation of the Raft consensus algorithm in Elixir.
- Elixir (version 1.18 or later)
- Erlang/OTP (compatible with your Elixir version)
git clone https://github.com/happybear-21/eliraft.git
cd eliraftFetch and install all dependencies:
mix deps.getCompile the source code:
mix compileYou can run the application in two ways:
Start an interactive Elixir shell with your application running:
iex -S mixRun the application without an interactive shell:
mix run --no-haltOnce 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"})| 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. |
- To run tests:
mix test - To generate documentation:
mix docs
GPL-3.0 license