{"_id":"58e6be0f85ec873100be97fc","parentDoc":null,"version":{"_id":"5612c2a00fbdb60d00e4c7d4","__v":7,"project":"5612c2a00fbdb60d00e4c7d1","createdAt":"2015-10-05T18:34:08.611Z","releaseDate":"2015-10-05T18:34:08.611Z","categories":["5612c2a10fbdb60d00e4c7d5","58e6b64bc397de1b00173c09","58e6b68eb1eece19008b81fe","58e6b6d185ec873100be9734","58f5e5c2616bbb1b00d54c15","58f5eaa74c413f19007a2858","58f767a79c723f19004e1ca9"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"0.0.1","version":"0.0.1"},"category":{"_id":"58e6b6d185ec873100be9734","project":"5612c2a00fbdb60d00e4c7d1","version":"5612c2a00fbdb60d00e4c7d4","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-04-06T21:44:49.026Z","from_sync":false,"order":3,"slug":"cluster-operations","title":"Partisan"},"githubsync":"","project":"5612c2a00fbdb60d00e4c7d1","user":"5612c290c0731b0d00625078","__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-04-06T22:15:43.860Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"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.\n\nTo retrieve this nodes current configuration, you can use the `myself` command.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"> partisan_peer_service_manager:myself().\\n{nonode:::at:::nohost,{127,0,0,1},51063}\",\n      \"language\": \"erlang\"\n    }\n  ]\n}\n[/block]\nTo return a sampling of nodes from the peer service, use the `members` command. \n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"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.\",\n  \"title\": \"Members are \\\"locally\\\" known\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"> partisan_peer_service:members().\\n{ok,[nonode@nohost]}\",\n      \"language\": \"erlang\"\n    }\n  ]\n}\n[/block]\nGiven the name of another node, you can use the `join` command to join to that node's cluster.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"> partisan_peer_service:join(Node)\\nok\",\n      \"language\": \"erlang\"\n    }\n  ]\n}\n[/block]\nTo remove yourself from the cluster, or to force another node to leave, use the `leave` operation.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"> partisan_peer_service:leave()\\nok\",\n      \"language\": \"erlang\"\n    }\n  ]\n}\n[/block]","excerpt":"How do I manage and cluster nodes using Partisan?","slug":"api","type":"basic","title":"Peer Service API"}

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. [block:code] { "codes": [ { "code": "> partisan_peer_service_manager:myself().\n{nonode@nohost,{127,0,0,1},51063}", "language": "erlang" } ] } [/block] To return a sampling of nodes from the peer service, use the `members` command. [block:callout] { "type": "warning", "body": "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.", "title": "Members are \"locally\" known" } [/block] [block:code] { "codes": [ { "code": "> partisan_peer_service:members().\n{ok,[nonode@nohost]}", "language": "erlang" } ] } [/block] Given the name of another node, you can use the `join` command to join to that node's cluster. [block:code] { "codes": [ { "code": "> partisan_peer_service:join(Node)\nok", "language": "erlang" } ] } [/block] To remove yourself from the cluster, or to force another node to leave, use the `leave` operation. [block:code] { "codes": [ { "code": "> partisan_peer_service:leave()\nok", "language": "erlang" } ] } [/block]