This library provides a mechanism for automatically forming clusters of Erlang nodes, with either static or dynamic node membership. It provides a pluggable "strategy" system, with a variety of strategies provided out of the box.
You can find supporting documentation here.
- Automatic cluster formation/healing
- Choice of multiple clustering strategies out of the box:
- Standard Distributed Erlang facilities (e.g.
epmd
,.hosts.erlang
), which supports IP-based or DNS-based names - Multicast UDP gossip, using a configurable port/multicast address,
- Kubernetes via its metadata API using via a configurable label selector and node basename; or alternatively, using DNS.
- Rancher, via its metadata API
- Standard Distributed Erlang facilities (e.g.
- Easy to provide your own custom clustering strategies for your specific environment.
- Easy to use provide your own distribution plumbing (i.e. something other than
Distributed Erlang), by implementing a small set of callbacks. This allows
libcluster
to support projects like Partisan.
defp deps do
[{:libcluster, "~> MAJ.MIN"}]
end
You can determine the latest version by running mix hex.info libcluster
in
your shell, or by going to the libcluster
page on Hex.pm.
It is easy to get started using libcluster
, simply decide which strategy you
want to use to form a cluster, define a topology, and then start the Cluster.Supervisor
module in
the supervision tree of an application in your Elixir system, as demonstrated below:
defmodule MyApp.App do
use Application
def start(_type, _args) do
topologies = [
example: [