How to connect to a registered Node (Erlang) and u

2019-08-01 08:40发布

问题:

I have a server application with a running node, awaits for rpc calls....

(n2@198.XXX.X.XX)>

I have a node started on a different machine in which I have ejabberd running as well

erl -name n2@198.XXX.X.XX -setcookie somecookie

(n1@198.XXX.X.XX)>

And then I have ejabberd server started with ejabberdctl live and I want to be able to ping n2 from n1 (n1@198.XXX.X.XX)>.

I can see that n1 is registered and running with net_adm:names().

I tried to do do directly from code net_adm:ping(n2@198.XXX.X.XX). but it says that system not running with qualified hostname

I need a way to connect/use to n1 and communicate with n2 How to switch to n1 and make the rpc to n2 programatically?

回答1:

Take a look at your particular ejabberdctl and grep for "name" or "sname". It says if node was started with short name or fully qualified. It must match your "erl -name". Identify one way of naming nodes and alter your node or ejabberd script.