Getting Started
View SourceThis guide walks you through installing RaftEx, starting a system, forming a cluster, and sending a command.
Installation
Add :raft_ex to your mix.exs dependencies:
{:raft_ex, "~> 0.5"}Then run:
mix deps.get
Starting a system
RaftEx.start()Or with a custom data directory:
RaftEx.start_in("/var/lib/raft_ex")Forming a cluster
machine = RaftEx.TestSupport.EchoMachine # or your own machine module
server_ids = [{:s1, node()}, {:s2, node()}, {:s3, node()}]
{:ok, started, []} =
RaftEx.start_cluster(:default, :my_cluster, machine, server_ids)Sending a command
{:ok, reply, leader} = RaftEx.process_command({:s1, node()}, {:put, :k, :v})Querying state
RaftEx.local_query({:s1, node()}, fn state -> state end)Next steps
- See
guides/architecture.mdfor the internal design. - See
guides/persistence.mdfor WAL and recovery. - See
RaftExmodule docs for the full API.