Tribe is the name of the clustering feature in Snap. When it is enabled, snapteld instances can join to one another through an agreement
. When an action is taken by one snapteld instance that is a member of an agreement, that action will be carried out by all other members of the agreement. When a new snapteld joins an existing agreement it will retrieve plugins and tasks from the members of the agreement.
This walkthrough assumes you have downloaded a Snap release as described in Getting Started.
Start the first node:
$ snapteld --tribe -t 0
Only --tribe
and some trust level (-t 0
) is required to start tribe. This will result in defaults for all other parameters:
- Default
tribe-node-name
will be the same as your hostname - Default
tribe-seed
is port 6000 - Default
tribe-addr
andtribe-port
are the same assnapteld
andtribe-seed
(ex. 127.0.0.1:6000)
See snapteld -h
for all the possible flags.
Members of a tribe only share configuration once they join an agreement. To create your first agreement:
$ snaptel agreement create all-nodes
Name Number of Members plugins tasks
all-nodes 0 0 0
Join our running snapteld into this agreement:
$ snaptel agreement join all-nodes `hostname`
Name Number of Members plugins tasks
all-nodes 1 0 0
Since tribe is implemented on top of a gossip based protocol there is no "master." All other nodes who join a tribe by communicating with any existing member.
Start another instance of snapteld to join to our existing tribe. The local IP address is 192.168.136.176 in our example. Note that we need a few more parameters to avoid conflicting ports on a single system:
$ snapteld --tribe -t 0 --tribe-port 6001 --api-port 8182 --tribe-node-name secondnodename --tribe-seed 192.168.136.176:6000 --control-listen-port 8083
Both snapteld instances will see each other in their member list:
$ snaptel member list
Name
secondnodename
firstnode
This member needs to join the agreement:
$ snaptel agreement join all-nodes secondnodename
Name Number of Members plugins tasks
all-nodes 2 0 0
From this point forward, any plugins or tasks you load will load into both members of this agreement.
Note: Once the cluster is started subsequent new nodes can choose to establish membership through any node as there is no "master".