RaftEx.ClusterSetup (raft_ex v0.1.0)

View Source

Convenience helpers for bootstrapping distributed RaftEx clusters across multiple Elixir nodes.

Use setup/3 or setup/4 to initialise distribution, start the RaftEx system, and form a cluster in a single call.

Summary

Functions

Connect to a remote node and verify it is reachable.

Full cluster bootstrap on the current node.

Start distributed Erlang with the given cookie.

Start the RaftEx system with the given data directory.

Verify that all given nodes are reachable and running RaftEx.

Functions

connect_node(node, cookie \\ :raft_ex)

Connect to a remote node and verify it is reachable.

setup(cluster_name, machine, node_configs, opts \\ [])

@spec setup(
  cluster_name :: term(),
  machine :: RaftEx.Machine.machine(),
  node_configs :: [map()],
  opts :: keyword()
) ::
  {:ok, [RaftEx.Types.server_id()], [RaftEx.Types.server_id()]}
  | {:error, term()}

Full cluster bootstrap on the current node.

Parameters

  • cluster_name — atom identifying the Raft cluster
  • machine — state machine config {:machine, Module, args}
  • node_configs — list of %{node: node(), data_dir: binary()} maps, one per participating node. The caller determines the data-dir for each node.
  • opts — keyword overrides (see RaftEx.Cluster.form_cluster/4).

Returns {:ok, local_server_ids, all_server_ids}.

start_distribution(cookie \\ :raft_ex)

Start distributed Erlang with the given cookie.

start_system(data_dir)

Start the RaftEx system with the given data directory.

verify_nodes(nodes, timeout \\ 5000)

Verify that all given nodes are reachable and running RaftEx.