Erlang:启动从节点
我正在尝试在集群上启动 Erlang 从节点,但收到 bash: erl: command not found 消息。虽然我有 erl 的别名。这就是我实际做的:
[user@n001 ~]$ erl -rsh ssh -sname n001
Eshell V5.7.5 (abort with ^G)
(n001@n001)1> slave:start_link("user@n002", n002, "-rsh ssh").
bash: erl: command not found
{error,timeout}
(n001@n001)2>
也许有什么问题? 谢谢。
更新:
我已将 Erlang bin dir 添加到我的 $PATH
变量中;我已经设置了 $ERLANG_ROOT_DIR
变量;在 ~/
中创建了 symlink
到 erl
- 但没有任何改变...
我已经在 ~/bin/erlang
目录中安装了 Erlang...
I'm trying to start Erlang slave node on cluster and I receive bash: erl: command not found
message. Though I have alias for erl. Here is what I actually do:
[user@n001 ~]$ erl -rsh ssh -sname n001
Eshell V5.7.5 (abort with ^G)
(n001@n001)1> slave:start_link("user@n002", n002, "-rsh ssh").
bash: erl: command not found
{error,timeout}
(n001@n001)2>
Maybe, there is something wrong?
Thanks.
UPDATE:
I've added Erlang bin dir to my $PATH
variable; I've set $ERLANG_ROOT_DIR
variable; created symlink
in ~/
to erl
- but nothing have changed...
I have installed Erlang in ~/bin/erlang
dir...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我的猜测是 Erlang cookie。
你能ping通n002吗?
如果是,那么两个节点是否具有相同的cookie?
例如你可以尝试:
erl -sname abc -rsh ssh -setcookie Secretcookie
erl>从机:开始(n002,名称,“-setcookie Secretcookie”)。 %% 所以这两个节点共享一个cookie
my guess is erlang cookie.
can you ping n002 ?
if yes, then do the two nodes have the same cookie ?
for example you can try:
erl -sname abc -rsh ssh -setcookie secretcookie
erl> slave:start(n002, name, "-setcookie secretcookie"). %% so these two nodes share a cookie
只是用来
检查 n002 上的 erl 是否正常。
Just use
to check if erl is ok on n002.
问题出在 bash 上:
实际上erlang通过ssh连接到node,以非交互模式调用默认的sh。
但是当 bash 以非交互模式启动时,它不会读取存储路径变量和别名的 .bashrc 。
所以我切换到了 zsh,现在一切正常了! ;)
The trouble was in bash:
Actually erlang connects to node via ssh, invoking default sh in non-interactive mode.
But when bash is started in non-interactive mode, it doesn't read .bashrc where my path variables and aliases are stored.
So I switched to zsh and all is ok now! ;)
我相信别名不会被尊重
erl 实际上需要在你的路径中
另外,我相信你的 .bashrc 也不会执行。因此,您可能必须将“erl”符号链接到 /usr/bin 或 /usr/local/bin
I believe that the alias won't be honored
erl needs to actually be in your path
Also, I believe that your .bashrc doesn't execute either. So you may have to symlink "erl" to /usr/bin or /usr/local/bin
您似乎在主机字段中使用了错误的格式 start_link/3;
它应该是一个代表节点名称(第二个参数,也是一个原子)应该启动的主机的原子,结果是节点Name@Host。
所以在你的情况下那就是
You seem to be using a wrong format for the Host field of start_link/3;
It should be an atom representing the host where the node Name (second parameter, also an atom) should be started, resulting in node Name@Host.
So in your case that would be