[英]Erlang: starting slave node
I'm trying to start Erlang slave node on cluster and I receive bash: erl: command not found
message.我正在尝试在集群上启动 Erlang 从属节点,但收到
bash: erl: command not found
消息。 Though I have alias for erl.虽然我有 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;我已经将 Erlang bin dir 添加到我的
$PATH
变量中; I've set $ERLANG_ROOT_DIR
variable;我已经设置了
$ERLANG_ROOT_DIR
变量; created symlink
in ~/
to erl
- but nothing have changed...在
~/
创建symlink
到erl
- 但没有任何改变......
I have installed Erlang in ~/bin/erlang
dir...我已经在
~/bin/erlang
目录中安装了 Erlang...
The trouble was in bash: Actually erlang connects to node via ssh, invoking default sh in non-interactive mode.问题出在 bash 上:实际上 erlang 通过 ssh 连接到节点,在非交互模式下调用默认 sh。 But when bash is started in non-interactive mode, it doesn't read .bashrc where my path variables and aliases are stored.
但是当 bash 在非交互模式下启动时,它不会读取 .bashrc ,其中存储了我的路径变量和别名。 So I switched to zsh and all is ok now!
所以我切换到 zsh,现在一切正常! ;)
;)
I believe that the alias won't be honored我相信别名不会被尊重
erl needs to actually be in your path erl 需要真正在你的道路上
Also, I believe that your .bashrc doesn't execute either.另外,我相信您的 .bashrc 也不会执行。 So you may have to symlink "erl" to /usr/bin or /usr/local/bin
所以你可能需要将“erl”符号链接到 /usr/bin 或 /usr/local/bin
You seem to be using a wrong format for the Host field of start_link/3;您似乎对 start_link/3 的 Host 字段使用了错误的格式;
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.它应该是一个原子,代表节点名称(第二个参数,也是一个原子)应该开始的主机,从而产生节点名称@Host。
So in your case that would be所以在你的情况下
slave:start_link('n002', 'n002', "-rsh ssh").
my guess is erlang cookie.我猜是二郎饼干。
can you ping n002 ?你能ping通n002吗? if yes, then do the two nodes have the same cookie ?
如果是,那么两个节点是否具有相同的 cookie?
for example you can try: erl -sname abc -rsh ssh -setcookie secretcookie例如,您可以尝试: erl -sname abc -rsh ssh -setcookie secretcookie
erl> slave:start(n002, name, "-setcookie secretcookie"). erl> slave:start(n002, name, "-setcookie secretcookie"). %% so these two nodes share a cookie
%% 所以这两个节点共享一个cookie
Just use只需使用
>ssh user@n002 erl
to check if erl is ok on n002.检查 erl 在 n002 上是否正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.