Erlang:无法启动从站 - {error,timeout}

Tom*_*ire 6 erlang slave tsung

我目前正在尝试建立一个使用 Erlang 从属功能的分布式 Tsung 负载测试环境,但是我没有成功让控制器节点启动从属节点。例如

(musicglue@load1)1> net:ping(musicglue@load2).
pong
(musicglue@load1)2> slave:start(load2,musicglue,"-setcookie tom").
{error,timeout}
Run Code Online (Sandbox Code Playgroud)

背景

我的环境:

控制器 - 主机名:load1,用户:musicglue,Ubuntu 10.04 LTS,从源代码编译的 Erlang R15B01

有效的事情:

  • 我可以通过 SSH 从 load1 连接到 load2,反之亦然
  • 我可以在 load1 和 load2 上启动一个 erl 会话
  • 我可以从 load1 在 load2 上启动一个 erl 会话;SSH 加载 2 erl
  • 我可以在两个节点上使用相同的 cookie 从 erl 会话成功地从 load1 ping load2。

平输出:

musicglue@load1:~$ erl -rsh ssh -sname musicglue -setcookie tom
Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4] [async-threads:
0] [hipe] [kernel-poll:false]
Eshell V5.9.1  (abort with ^G)
(musicglue@load1)1> net:ping(musicglue@load2).
pong
Run Code Online (Sandbox Code Playgroud)

问题

尝试从 load2 上的 load1 启动从属会话时出现问题:

musicglue@load1:~$ erl -rsh ssh -sname musicglue -setcookie tom
Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4] [async-threads:
0] [hipe] [kernel-poll:false]

Eshell V5.9.1  (abort with ^G)
(musicglue@load1)1> net:ping(musicglue@load2).
pong
(musicglue@load1)2> slave:start(load2,musicglue,"-setcookie
tom").
{error,timeout}
Run Code Online (Sandbox Code Playgroud)

这是我在运行 slave:start 命令时从 epmd 得到的输出:

epmd: Thu May 24 10:01:57 2012: Non-local peer connected
epmd: Thu May 24 10:01:57 2012: opening connection on file descriptor
4
epmd: Thu May 24 10:01:57 2012: got 12 bytes
***** 00000000  00 0a 7a 6d 75 73 69 63 67 6c 75 65
|..zmusicglue|
epmd: Thu May 24 10:01:57 2012: ** got PORT2_REQ
epmd: Thu May 24 10:01:57 2012: got 2 bytes
***** 00000000  77 01                                             |w.|
epmd: Thu May 24 10:01:57 2012: ** sent PORT2_RESP (error) for
"musicglue"
epmd: Thu May 24 10:01:57 2012: closing connection on file descriptor
4
epmd: Thu May 24 10:01:57 2012: Local peer connected
epmd: Thu May 24 10:01:57 2012: opening connection on file descriptor
4
epmd: Thu May 24 10:01:57 2012: got 24 bytes
***** 00000000  00 16 78 ca d6 4d 00 00  05 00 05 00 09 6d 75 73
|..x..M.......mus|
***** 00000010  69 63 67 6c 75 65 00 00                           |
icglue..|
epmd: Thu May 24 10:01:57 2012: ** got ALIVE2_REQ
epmd: Thu May 24 10:01:57 2012: registering 'musicglue:1', port 51926
epmd: Thu May 24 10:01:57 2012: type 77 proto 0 highvsn 5 lowvsn 5
epmd: Thu May 24 10:01:57 2012: got 4 bytes
***** 00000000  79 00 00 01                                       |
y...|
epmd: Thu May 24 10:01:57 2012: ** sent ALIVE2_RESP for "musicglue"
epmd: Thu May 24 10:01:57 2012: unregistering 'musicglue:1', port
51926
epmd: Thu May 24 10:01:57 2012: closing connection on file descriptor
4
Run Code Online (Sandbox Code Playgroud)

任何人的任何帮助或建议将不胜感激,

非常感谢

编辑

我还应该提到,我可以看到 load2 成功确认了 ssh 连接,但随后立即断开连接:

May 30 13:49:27 load2 sshd[16169]: Accepted publickey for musicglue from 173.45.236.182 port 51843 ssh2
May 30 13:49:27 load2 sshd[16171]: Received disconnect from 173.45.236.182: 11: disconnected by user
Run Code Online (Sandbox Code Playgroud)

针对以下评论,我还尝试使用不同的从站节点名称启动从站:

musicglue@load1:~$ erl -rsh ssh -sname musicglue -setcookie tom
Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.9.1  (abort with ^G)
(musicglue@load1)1> slave:start(load2,bar,"-setcookie tom").
{error,timeout}
Run Code Online (Sandbox Code Playgroud)

对于控制器:

musicglue@load1:~$ erl -rsh ssh -sname foo -setcookie tom
Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.9.1  (abort with ^G)
(foo@load1)1> slave:start(load2,musicglue,"-setcookie tom").
{error,timeout}
Run Code Online (Sandbox Code Playgroud)

对于两者:

musicglue@load1:~$ erl -rsh ssh -sname foo -setcookie tom
Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.9.1  (abort with ^G)
(foo@load1)1> slave:start(load2,bar,"-setcookie tom").
{error,timeout}
Run Code Online (Sandbox Code Playgroud)

但无济于事

解决方案

原来我的问题是我的从站无法通过 SSH 连接到控制器,因此无法响应任何命令。

在修复了两个节点之间的这个通信端口后,每个人都工作得很好。

leg*_*cia 2

尝试通过在以下位置创建一个 shell 脚本来记录通过 SSH 发生的情况PATH

#!/bin/sh

echo "$0" "$@" > /tmp/my-ssh.log
ssh -v "$@"  2>&1 | tee -a /tmp/my-ssh.log
Run Code Online (Sandbox Code Playgroud)

调用它my-ssh,启动 Erlang erl -rsh my-ssh,并检查其中的内容/tmp/my-ssh.log。这应该可以说明问题......