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.

$ ./rebar3 shell --apps lasp --name lasp1@localhost

Start the second node "lasp2".

$ ./rebar3 shell --apps lasp --name lasp2@localhost

Then, get the second node's network information.

(lasp2@localhost)1> partisan_peer_service_manager:myself(). #{name => lasp2@localhost, listen_addrs => [#{ip => {127,0,0,1}, port => 56699}]}

Then, join the first node to the second node.

(lasp1@localhost)2> lasp_peer_service:join(#{name => lasp2@localhost, listen_addrs => [#{ip => {127,0,0,1}, port => 56699}]}). =PROGRESS REPORT==== 20-Apr-2017::11:59:14 === supervisor: {local,inet_gethost_native_sup} started: [{pid,<0.376.0>},{mfa,{inet_gethost_native,init,[[]]}}] =PROGRESS REPORT==== 20-Apr-2017::11:59:14 === supervisor: {local,kernel_safe_sup} started: [{pid,<0.375.0>}, {id,inet_gethost_native_sup}, {mfargs,{inet_gethost_native,start_link,[]}}, {restart_type,temporary}, {shutdown,1000}, {child_type,worker}] ok (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.

Did this page help you?