KantanCluster (kantan_cluster v0.2.2) View Source

Form a simple Erlang cluster easily in Elixir.

Link to this section Summary

Types

A node type. See Node.start/3.

Options for a cluster.

Functions

Connects current node to specified nodes.

Disconnects current node from speficied nodes.

Starts a node and attempts to connect it to specified nodes. Configuration options can be specified as an argument

Stops a node and all the connections.

Link to this section Types

Specs

node_type() :: :longnames | :shortnames

A node type. See Node.start/3.

Specs

option() ::
  {:node, {node_type(), node()}}
  | {:cookie, atom()}
  | {:connect_to, node() | [node()]}

Options for a cluster.

  • :node - a name of the node that you want to start (default: {:longnames, :"xxxx@yyyy.local"} where xxxx is a random string, yyyy is the hostname of a machine)
  • :cookie - Erlang magic cookie to form a cluster (default: random cookie)
  • :connect_to - a list of nodes we want our node to be connected with (default: [])

Link to this section Functions

Specs

connect(node()) :: pid() | nil
connect([node()]) :: [pid() | nil]

Connects current node to specified nodes.

Specs

disconnect(node()) :: :ok
disconnect([node()]) :: :ok

Disconnects current node from speficied nodes.

Specs

start([option()]) :: :ok

Starts a node and attempts to connect it to specified nodes. Configuration options can be specified as an argument

KantanCluster.start(
  cookie: :hello,
  connect_to: [:"nerves@nerves-mn00.local"]
)

or in your config/config.exs.

config :kantan_cluster,
  cookie: :hello,
  connect_to: [:"nerves@nerves-mn00.local"]

Specs

stop() :: :ok | {:error, :not_allowed | :not_found}

Stops a node and all the connections.