SuperPi.Cluster (super_pi v0.1.0)

Copy Markdown View Source

The distributed BEAM cluster: nodes connected by libcluster, one shared PostgreSQL, one machine per conversation (SuperPi.Conversation.Locator).

Configuration

config :super_pi, :cluster is set from the environment (config/runtime.exs):

VariableMeaning
SUPER_PI_CLUSTER_STRATEGYnone (default), epmd, dnspoll, kubernetes_dns, gossip
SUPER_PI_CLUSTER_HOSTSepmd: node names, comma separated (super_pi@10.0.0.1,super_pi@10.0.0.2)
SUPER_PI_CLUSTER_DNS_QUERYdnspoll: a name that resolves to every node (A records)
SUPER_PI_CLUSTER_NODE_BASENAMEdnspoll, kubernetes_dns: the node name before @ (default super_pi)
SUPER_PI_CLUSTER_K8S_SERVICEkubernetes_dns: the headless Service name
SUPER_PI_CLUSTER_POLL_MSpolling interval for dnspoll and kubernetes_dns (default 5000)
SUPER_PI_CLUSTER_GOSSIP_SECRETgossip: shared secret for the multicast packets
SUPER_PI_CLUSTER_GOSSIP_PORTgossip: UDP port (default 45892)

Nodes also need a distribution name and a shared cookie (RELEASE_NODE, RELEASE_COOKIE with a release; --name and --cookie otherwise). A cluster requires PostgreSQL: with SQLite the application refuses to start.

Summary

Functions

Child specs for the application: the libcluster supervisor when a strategy is configured.

True when a cluster strategy is configured.

A summary of the cluster: this node, the connected nodes, the registry and supervisor members, and how many conversation machines run on each node.

The libcluster topologies from configuration. Empty when clustering is off.

Raises when the configuration cannot work: a cluster over SQLite. Called at application start.

Functions

children()

Child specs for the application: the libcluster supervisor when a strategy is configured.

enabled?()

True when a cluster strategy is configured.

status()

A summary of the cluster: this node, the connected nodes, the registry and supervisor members, and how many conversation machines run on each node.

strategy()

topologies()

The libcluster topologies from configuration. Empty when clustering is off.

validate!()

Raises when the configuration cannot work: a cluster over SQLite. Called at application start.