How to run an application distributed using Rebar?

Solution 1:

To connect two or more nodes, you need also set same cookies for each node. And then ping those nodes by net_adm:ping/1. Here is example(expected that terminals will start at the same time ):

Terminal #1:

$ ./rebar3 shell --sname a --setcookie test
Erlang/OTP 24 [erts-12.1.5] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]

Eshell V12.1.5  (abort with ^G)
(a@pc)1> nodes().
[]

Terminal #2:

$ ./rebar3 shell --sname b --setcookie test
Erlang/OTP 24 [erts-12.1.5] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]

Eshell V12.1.5  (abort with ^G)
(b@pc)1> nodes().
[]

As you see, when you run it - we don't have any nodes. Now lets try use net_adm:ping/1 to connect them. Terminal #1:

$ ./rebar3 shell --sname a --setcookie test
Erlang/OTP 24 [erts-12.1.5] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]

Eshell V12.1.5  (abort with ^G)
(a@pc)1> nodes().
[]
(a@pc)2> net_adm:ping('b@pc').
pong
(a@pc)3> nodes().
[b@pc]

Terminal #2:

$ ./rebar3 shell --sname b --setcookie test
Erlang/OTP 24 [erts-12.1.5] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]

Eshell V12.1.5  (abort with ^G)
(b@pc)1> nodes().
[a@pc]

Also, I suppose you can join to https://erlangforums.com/ - in the Erlang community forum you can find answers to any questions related to Erlang/OTP fast enough. P.S. The name and cookie you can set also by vm.args file.