簡體   English   中英

Erlang:無法啟動slave - {error,timeout}

[英]Erlang: Cannot start slave - {error,timeout}

我目前正在嘗試建立一個使用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從源Slave編譯 - 主機名:load2,用戶:musicglue,Ubuntu 10.04 LTS,Erlang R15B01從源防火牆禁用SELinux未安裝

工作的事情:

  • 我可以從load1 SSH到load2,反之亦然
  • 我可以在load1和load2上啟動erl會話
  • 我可以從load1開始在load2上進行erl會話; ssh load2 erl
  • 我可以在兩個節點上使用相同的cookie從erl會話成功ping load1來自load1。

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時從epmd獲得的輸出:start命令:

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連接到控制器,因此無法響應任何命令。

在修復這兩個節點之間的通信端口后,每個人都完美地工作。

嘗試通過在PATH某個位置創建這樣的shell腳本來記錄通過SSH進行的操作:

#!/bin/sh

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

說它是my-ssh ,下手二郎erl -rsh my-ssh ,並檢查什么進入/tmp/my-ssh.log 這應該可以解釋這個問題......

對於那些通過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").

此命令現在成功。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM