{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","results":{"codes":[]},"settings":"","params":[]},"next":{"description":"","pages":[]},"title":"Build a Two Node Cluster","type":"basic","slug":"starting-and-clustering-two-nodes","excerpt":"How do we join two nodes together in a single cluster?","body":"Start the first node \"lasp1\".\n\nIf your Erlang system is configured to use only fully qualified host names, then in both of the following commands, replace \":::at:::localhost\" with \"@\\`hostname\\`\"\n where \"hostname\" is surrounded by backticks.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ ./rebar3 shell --apps lasp --name [email protected]\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nStart the second node \"lasp2\".\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ ./rebar3 shell --apps lasp --name [email protected]\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nThen, get the second node's network information.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"([email protected])1> partisan_peer_service_manager:myself().\\n#{name => [email protected], listen_addrs => [#{ip => {127,0,0,1}, port => 56699}]}\",\n      \"language\": \"erlang\"\n    }\n  ]\n}\n[/block]\nThen, join the first node to the second node.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"([email protected])2> lasp_peer_service:join(#{name => [email protected], listen_addrs => [#{ip => {127,0,0,1}, port => 56699}]}).\\n\\n=PROGRESS REPORT==== 20-Apr-2017::11:59:14 ===\\n          supervisor: {local,inet_gethost_native_sup}\\n             started: [{pid,<0.376.0>},{mfa,{inet_gethost_native,init,[[]]}}]\\n\\n=PROGRESS REPORT==== 20-Apr-2017::11:59:14 ===\\n          supervisor: {local,kernel_safe_sup}\\n             started: [{pid,<0.375.0>},\\n                       {id,inet_gethost_native_sup},\\n                       {mfargs,{inet_gethost_native,start_link,[]}},\\n                       {restart_type,temporary},\\n                       {shutdown,1000},\\n                       {child_type,worker}]\\nok\\n([email protected])3> 11:59:14.891 [info] Join ACCEPTED with #{name => [email protected], listen_addrs => [#{ip => {127,0,0,1}, port => 56699}]}; node is undefined and we are undefined: we have 2 members in our view.\",\n      \"language\": \"erlang\"\n    }\n  ]\n}\n[/block]","updates":["59e8c20813d5c4002666a05c","59e9c8bcf8ce720030c99dff","59ea109ca90dc1002e7c5b9c","59ea113db4557c00242dc137","59f2f0a280a41b003a16e044"],"order":999,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"58f887353454b3190089a35f","user":"5612c290c0731b0d00625078","version":{"version":"0.0.1","version_clean":"0.0.1","codename":"","is_stable":true,"is_beta":true,"is_hidden":false,"is_deprecated":false,"categories":["5612c2a10fbdb60d00e4c7d5","58e6b64bc397de1b00173c09","58e6b68eb1eece19008b81fe","58e6b6d185ec873100be9734","58f5e5c2616bbb1b00d54c15","58f5eaa74c413f19007a2858","58f767a79c723f19004e1ca9"],"_id":"5612c2a00fbdb60d00e4c7d4","createdAt":"2015-10-05T18:34:08.611Z","releaseDate":"2015-10-05T18:34:08.611Z","__v":7,"project":"5612c2a00fbdb60d00e4c7d1"},"category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Lasp Internals","slug":"lasp-internals","order":4,"from_sync":false,"reference":false,"_id":"58f767a79c723f19004e1ca9","createdAt":"2017-04-19T13:35:35.184Z","project":"5612c2a00fbdb60d00e4c7d1","version":"5612c2a00fbdb60d00e4c7d4","__v":0},"createdAt":"2017-04-20T10:02:29.243Z","__v":5,"githubsync":"","project":"5612c2a00fbdb60d00e4c7d1"}

Build a Two Node Cluster

How do we join two nodes together in a single cluster?

Start the first node "lasp1". If your Erlang system is configured to use only fully qualified host names, then in both of the following commands, replace "@localhost" with "@\`hostname\`" where "hostname" is surrounded by backticks. [block:code] { "codes": [ { "code": "$ ./rebar3 shell --apps lasp --name [email protected]", "language": "text" } ] } [/block] Start the second node "lasp2". [block:code] { "codes": [ { "code": "$ ./rebar3 shell --apps lasp --name [email protected]", "language": "shell" } ] } [/block] Then, get the second node's network information. [block:code] { "codes": [ { "code": "([email protected])1> partisan_peer_service_manager:myself().\n#{name => [email protected], listen_addrs => [#{ip => {127,0,0,1}, port => 56699}]}", "language": "erlang" } ] } [/block] Then, join the first node to the second node. [block:code] { "codes": [ { "code": "([email protected])2> lasp_peer_service:join(#{name => [email protected], listen_addrs => [#{ip => {127,0,0,1}, port => 56699}]}).\n\n=PROGRESS REPORT==== 20-Apr-2017::11:59:14 ===\n supervisor: {local,inet_gethost_native_sup}\n started: [{pid,<0.376.0>},{mfa,{inet_gethost_native,init,[[]]}}]\n\n=PROGRESS REPORT==== 20-Apr-2017::11:59:14 ===\n supervisor: {local,kernel_safe_sup}\n started: [{pid,<0.375.0>},\n {id,inet_gethost_native_sup},\n {mfargs,{inet_gethost_native,start_link,[]}},\n {restart_type,temporary},\n {shutdown,1000},\n {child_type,worker}]\nok\n([email protected])3> 11:59:14.891 [info] Join ACCEPTED with #{name => [email protected], listen_addrs => [#{ip => {127,0,0,1}, port => 56699}]}; node is undefined and we are undefined: we have 2 members in our view.", "language": "erlang" } ] } [/block]