Peer Service API
How do I manage and cluster nodes using Partisan?
Each node running Partisan listens for connections on a particular IP address and port. This is the information that is required when other nodes wish to join this node.
To retrieve this nodes current configuration, you can use the myself
command.
> partisan_peer_service_manager:myself().
{nonode@nohost,{127,0,0,1},51063}
To return a sampling of nodes from the peer service, use the members
command.
Members are "locally" known
Keep in mind, if you're using the modified HyParView manager or client-server manager, this will only be a sampling, whereas the default manager will return all nodes that currently are connected.
> partisan_peer_service:members().
{ok,[nonode@nohost]}
Given the name of another node, you can use the join
command to join to that node's cluster.
> partisan_peer_service:join(Node)
ok
To remove yourself from the cluster, or to force another node to leave, use the leave
operation.
> partisan_peer_service:leave()
ok
Updated less than a minute ago