{"_id":"58f887353454b3190089a35f","user":"5612c290c0731b0d00625078","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":"58f767a79c723f19004e1ca9","project":"5612c2a00fbdb60d00e4c7d1","version":"5612c2a00fbdb60d00e4c7d4","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-04-19T13:35:35.184Z","from_sync":false,"order":4,"slug":"lasp-internals","title":"Lasp Internals"},"__v":5,"project":"5612c2a00fbdb60d00e4c7d1","updates":["59e8c20813d5c4002666a05c","59e9c8bcf8ce720030c99dff","59ea109ca90dc1002e7c5b9c","59ea113db4557c00242dc137","59f2f0a280a41b003a16e044"],"next":{"pages":[],"description":""},"createdAt":"2017-04-20T10:02:29.243Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":999,"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 lasp1@localhost\",\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 lasp2@localhost\",\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\": \"(lasp2@localhost)1> partisan_peer_service_manager:myself().\\n#{name => lasp2@localhost, 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\": \"(lasp1@localhost)2> lasp_peer_service:join(#{name => lasp2@localhost, 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(lasp1@localhost)3> 11:59:14.891 [info] Join ACCEPTED with #{name => lasp2@localhost, 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]","excerpt":"How do we join two nodes together in a single cluster?","slug":"starting-and-clustering-two-nodes","type":"basic","title":"Build a Two Node Cluster"}

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 lasp1@localhost", "language": "text" } ] } [/block] Start the second node "lasp2". [block:code] { "codes": [ { "code": "$ ./rebar3 shell --apps lasp --name lasp2@localhost", "language": "shell" } ] } [/block] Then, get the second node's network information. [block:code] { "codes": [ { "code": "(lasp2@localhost)1> partisan_peer_service_manager:myself().\n#{name => lasp2@localhost, 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": "(lasp1@localhost)2> lasp_peer_service:join(#{name => lasp2@localhost, 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(lasp1@localhost)3> 11:59:14.891 [info] Join ACCEPTED with #{name => lasp2@localhost, 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]