I have a node started on
erl -name n1@198.XXX.X.XX -setcookie somecookie
(n1@198.XXX.X.XX)>
but then I have another erlang application in which I have a module where I want to use the node that I have just registered (n1@198.XXX.X.XX). I tried to do do directly from code net_adm:ping(n1@198.XXX.X.XX). and I get a pang. I can see that net_adm:names(). returns in the tuple all the registered and living nodes.{ok [{node, 999}],[{n1,9993}],[{theappnode, 8383}]}
I need a way to connect to n1, and then use to to ping another remote node with rpc, something like
conn = connect to node (n1) and then do the rpc... these all from the module code of another erlang application.... Is the above possible?
Possibly your other node wasn't started with the same cookie. You have two solutions:
Start the other node with the same cookie
erl -name otherapp -setcookie some cookie 1> net_adm:ping('n1@198.XXX'). pong
Start the other node and tell it what is the cookie of the n1 node.
erl -name otherapp 1> net_adm:ping('n1@198.XXX'). pang 2> erlang:set_cookie('n1@198.XXX', 'somecookie'). true 3> net_adm:ping('n1@198.XXX'). pong
You cannot mix short names and long names (-sname and -name) in a distributed cluster.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.