Permalink
Fetching contributors…
Cannot retrieve contributors at this time
111 lines (80 sloc) 4.59 KB





Tribe

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.

Usage

This walkthrough assumes you have downloaded a Snap release as described in Getting Started.

Starting the first snapteld in tribe mode

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 and tribe-port are the same as snapteld and tribe-seed (ex. 127.0.0.1:6000)

See snapteld -h for all the possible flags.

Creating an initial agreement

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

Joining other snapteld into an existing tribe

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".

Examples

Starting a 4 node cluster and listing members

tribe-connect-seed

Creating an agreement and joining members to it

tribe-create-join-agreement

Loading plugins and starting tasks in tribe mode

Loading plugins on a node participating in an agreement:

tribe-load-plugins Note: After loading a collector and publisher plugins on one node, we demonstrate that these plugins are available on all of the other nodes in the agreement.

Listing available metrics on all nodes participating in an agreement:

tribe-metric-catalog

Starting a task on a node participating in an agreement:

tribe-task-watch Note: After starting a task on one node, we demonstrate that tasks are now running on all of the other nodes in the agreement