6

現在、Erlang スレーブ機能を使用する分散 Tsung 負荷テスト環境をセットアップしようとしていますが、コントローラー ノードでスレーブ ノードを起動することができませんでした。例えば

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

バックグラウンド

私の環境:

コントローラー - ホスト名: load1、ユーザー: musicglue、Ubuntu 10.04 LTS、ソースからコンパイルされた Erlang R15B01 スレーブ - ホスト名: load2、ユーザー: musicglue、Ubuntu 10.04 LTS、ソースからコンパイルされた Erlang R15B01 ファイアウォールが無効 SELinux がインストールされていない

機能しているもの:

  • load1 から load2 に SSH で接続でき、その逆も可能
  • load1 と load2 で erl セッションを開始できます
  • load1 から load2 で erl セッションを開始できます。ssh load2 erl
  • 両方のノードで同じ Cookie を使用して、erl セッションから load1 から load2 に正常に ping できます。

Ping 出力:

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

問題

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}

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

誰でも助けや提案をいただければ幸いです。

どうもありがとう

編集

また、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

以下のコメントに応えて、スレーブに別のノード名を使用してスレーブを起動しようとしました。

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}

コントローラーの場合:

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}

そして両方のために:

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}

しかし、役に立たない

解決

私の問題は、スレーブがコントローラーに SSH 接続できなかったため、コマンドに応答できなかったことであることがわかりました。

2 つのノード間のこの通信ポートを修正した後、全員が完全に機能しました。

4

2 に答える 2

3

Google でこの質問を見つけた人向けの別の回答。別のマシンでサービスを開始しようとしている場合は、コントローラー ノード名を解決する必要があります。

たとえば、次のようにタイムアウトしていました。

> node().
someName@host.domain.com
> slave:start('192.168.122.196',bar,"-setcookie cookie").
{error,timeout}

明示的なドメイン名で私の erlang インスタンスを開始することにより:

erl -name someName@192.168.1.5 -setcookie cookie
> slave:start('192.168.122.196',bar,"-setcookie cookie").

このコマンドは成功するようになりました。

于 2013-02-06T18:04:16.170 に答える
2

のどこかに次のようなシェル スクリプトを作成して、SSH 経由で何が起こっているかをログに記録してみてくださいPATH

#!/bin/sh

echo "$0" "$@" > /tmp/my-ssh.log
ssh -v "$@"  2>&1 | tee -a /tmp/my-ssh.log

それを呼び出してmy-ssh、Erlang を で起動しerl -rsh my-ssh、何が入っているかを確認し/tmp/my-ssh.logます。それは問題にいくつかの光を当てるはずです...

于 2012-05-31T10:54:54.343 に答える