I’m a beginner using erlang and I’m facing certain problems related to erlang in a distributed way, I can’t connect one node to the other, it always gives “ignored” or else using ‘net_adm’ returns pong, I made the default configuration of erlang as it is in the documentation , I’m using windows.
3 Likes
if net_adm:ping
returns pong
, that the ping and the connection were successful. You can check if the node A is connected to node B by calling erlang:nodes()
on either of those nodes. Also, make sure that both nodes have their short or long names set.
1 Like
ignored
means that the node you are trying to connect from is not distributed itself.
Example (when I do not start distribution):
$ erl
Erlang/OTP 25 [erts-13.0.4] [source-3a960e1963] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]
Eshell V13.0.4 (abort with ^G)
1> net_kernel:connect_node('nodeb@localhost').
ignored
2>
Now, the same example when I start the distributed node (supplying “-sname” command line argument):
$ erl -sname nodea
Erlang/OTP 25 [erts-13.0.4] [source-3a960e1963] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]
Eshell V13.0.4 (abort with ^G)
(nodea@ubuntu22)1> net_kernel:connect_node('nodeb@localhost').
false
You can always test if your node is distributed or not:
(nodea@ubuntu22)2> erlang:is_alive().
true
And if you need to start distribution dynamically, you can do:
1> net_kernel:start([nodea, shortnames]).
{ok,<0.88.0>}
3 Likes