Tribe is the name of the clustering feature in snap. When it is enabled nodes
will agree on plugins and/or tasks when they join what is called an
agreement
. When an action is taken on a node that is a member of an agreement
that action will be carried out by all other members of the agreement. When a
new node joins an existing agreement it will retrieve plugins and tasks from
the members of the agreement.
The first node
$SNAP_PATH/bin/snapd --tribe
All other nodes who join will need to select any existing member of the cluster. Since tribe is implemented on top of a gossip based protocol there is no "master".
$SNAP_PATH/bin/snapd --tribe-seed <IP or name of another tribe member>
After starting in tribe mode all nodes in the cluster can be listed.
$SNAP_PATH/bin/snapctl member list
Starting a 4 node cluster and listing members
Note: Once the cluster is started subsequent new nodes can choose to establish membership through any node as there is no "master".
$SNAP_PATH/bin/snapctl agreement create <agreement_name>
$SNAP_PATH/bin/snapctl agreement list
$SNAP_PATH/bin/snapctl agreement join <agreement_name> <member_name>
$SNAP_PATH/bin/snapctl agreement delete <agreement_name>
$SNAP_PATH/bin/snapctl agreement leave <agreement_name> <member_name>
Creating an agreement and joining members to it
After an agreement is created and members join it an action, such as loading/unloading plugins and adding/removing and starting/stopping tasks, taken on a single node in the agreement will be carried out on all members of the agreement.
In the example below an agreement has been created and all members of the cluster have joined it. After loading a collector and publishing plugin and starting a task on one node we demonstrate that the plugins and tasks are now running on all of the other nodes in the agreement.
*Loading plugins and starting a task on a node participating in an agreement