KantanCluster (kantan_cluster v0.2.0) View Source

Form a simple Erlang cluster easily in Elixir.

Link to this section Summary

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 KantanCluster.NodeConnector server.

Link to this section Types

Specs

node_type() :: :longnames | :shortnames

A node type. See https://hexdocs.pm/elixir/1.12/Node.html#start/3

Specs

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

Options for a cluster.

  • :node - the name of a node that we want to start (default: {:longnames, :"xxxx@127.0.0.1"} where xxxx is a random string)
  • :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() | [node()]) :: GenServer.on_start() | [GenServer.on_start()]

Connects current node to specified nodes.

Specs

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

Disconnects current node from speficied nodes.

Specs

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

KantanCluster.start(
  node: {:longnames, :"node1@127.0.0.1"},
  cookie: :hello,
  connect_to: [:"nerves@nerves-mn00.local"]
)

or in your config/config.exs.

config :kantan_cluster,
  node: {:longnames, :"node1@127.0.0.1"},
  cookie: :hello,
  connect_to: [:"nerves@nerves-mn00.local"]

Stops a node and KantanCluster.NodeConnector server.