[英]Erlang ping node problem
I made in erlang shell: 我在erlang shell中制作:
1> node().
nonode@nohost
But 但
2> net_adm:ping(node()).
pang
Why? 为什么? What's problem?
什么问题? Why not pong?
为什么不打乒乓球?
Thank you. 谢谢。
You didn't start Erlang with -name
or -sname
, which means that the distribution subsystem was not started. 您没有使用
-name
或-sname
启动Erlang,这意味着未启动分发子系统。 Try this: 试试这个:
$ erl -sname mynode
Erlang R14B02 (erts-5.8.3) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.8.3 (abort with ^G)
(mynode@foobar)1> node().
mynode@foobar
(mynode@foobar)2> net_adm:ping(node()).
pong
I am not 100% sure, but You started erl without "-name" oder "-sname". 我不是百分百肯定,但你开始没有“-name”oder“-sname”。 I believe net_adm:ping/1 only works in a distributed mode.
我相信net_adm:ping / 1只能在分布式模式下工作。
If you are trying to ping an erlang node but getting a pang
. 如果您正在尝试ping一个erlang节点但是会发生一阵
pang
。
Check the cookie with erlang:get_cookie()
it will be some random string set the cookie of another node with erlang:set_cookie(Node, Cookie)
or you could pass the cookie to the flag -setcookie
用
erlang:get_cookie()
检查cookie erlang:get_cookie()
它将是一些随机字符串,用erlang:set_cookie(Node, Cookie)
设置另一个节点的cookie erlang:set_cookie(Node, Cookie)
或者你可以将cookie传递给标志-setcookie
for example: 例如:
(foo@earth) erlang:get_cookie().
ASYRQKVNIFHWIIJQZIYN
(foo@earth) erlang:set_cookie(node(), 'secret cookie').
true
net:ping('mongooseim@localhost').
pong
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.