View Source Cluster-Bot
Introduction • Installation • Getting Started
Introduction
ClusterBot
is a small elixir library to manage nodes and automatically reconnect if a node disconnects thus trying to maintain a constant pool of nodes.
Nodes are cached using Cachex and stored to the file system.
If a node is not reachable in 24 hours, it will permamently be removed from the cache.
Installation
Add cluster_bot
to your list of dependencies in mix.exs
:
def deps do
[
{:cluster_bot, "~> 0.1.0"}
]
end
Getting Started
The ClusterMonitor implements the GenServer behavior and is thus usable with a standard OTP supervision tree.
children = [
ClusterMonitor,
...
]
Supervisor.start_link(children, [
strategy: :one_for_one,
name: Your.Supervisor
])
You are also able to change some parameters in you config. This is purly optional and mainly involves interval times:
config :logger, ClusterMonitor, level: :error # To prevent logging
config :cluster_bot,
fetch_interval: 5_000,
reconnect_interval: 5_000,
refresh_interval: 60_000,
output: "cache.bin"
The library doesn't have any interfaces, as it serves as a watchdog.