努力连接在单独的盒子上运行的 2 个节点。试图确保 cookie 同步、DNS 或防火墙没有常见问题。
首先,我按照 Erlang 文档的建议在调试模式下运行 epmd:
epmd -d -d
然后在框 #1:
erl -name xmpp1@server1.net -kernel inet_dist_listen_min 6000 inet_dist_listen_max 6050 -setcookie testcookie
并在框 #2:
erl -name xmpp2@server2.net -kernel inet_dist_listen_min 6000 inet_dist_listen_max 6050 -setcookie testcookie
ping 不走运。例如,在框 #2 上:
Erlang (BEAM) emulator version 5.6.4 [source] [64-bit] [smp:4] [async-threads:0] [kernel-poll:false]
Eshell V5.6.4 (abort with ^G)
(xmpp2@server2.net)1> net_adm:ping('xmpp1@server1.net').
pang
server1.net 上的 epmd 显示如下:
epmd: Sun Sep 12 01:40:32 2010: opening connection on file descriptor 6
epmd: Sun Sep 12 01:40:32 2010: got 8 bytes
***** 00000000 00 06 7a 78 6d 70 70 31 |..zxmpp1|
epmd: Sun Sep 12 01:40:32 2010: ** got PORT2_REQ
epmd: Sun Sep 12 01:40:32 2010: got 18 bytes
***** 00000000 77 00 17 70 4d 00 00 05 00 05 00 05 78 6d 70 70 |w..pM.......xmpp|
***** 00000010 31 00 |1.|
epmd: Sun Sep 12 01:40:32 2010: ** sent PORT2_RESP (ok) for "xmpp1"
epmd: Sun Sep 12 01:40:32 2010: closing connection on file descriptor 6
即,似乎从第二个节点接收到 ping 请求并以 ok 响应。
Tshark 在 epmd 端口(TCP 4369)上侦听给出以下信息(我用服务器名称替换了真实 IP):
1 0.000000 server2.net -> server1.net TCP 43809 > epmd [SYN] Seq=0 Win=5840 Len=0 MSS=1460 SACK_PERM=1 TSV=776213773 TSER=0 WS=5
2 0.000433 server1.net -> server2.net TCP epmd > 43809 [SYN, ACK] Seq=0 Ack=1 Win=5792 Len=0 MSS=1460 SACK_PERM=1 TSV=1595930818 TSER=776213773 WS=6
3 0.000483 server2.net -> server1.net TCP 43809 > epmd [ACK] Seq=1 Ack=1 Win=5856 Len=0 TSV=776213773 TSER=1595930818
4 0.000545 server2.net -> server1.net EPMD 43809 > epmd [PSH, ACK] Seq=1 Ack=1 Win=5856 Len=8 TSV=776213773 TSER=1595930818
5 0.001445 server1.net -> server2.net TCP epmd > 43809 [ACK] Seq=1 Ack=9 Win=5824 Len=0 TSV=1595930818 TSER=776213773
6 0.001466 server1.net -> server2.net EPMD epmd > 43809 [PSH, ACK] Seq=1 Ack=9 Win=5824 Len=18 TSV=1595930818 TSER=776213773
7 0.001474 server2.net -> server1.net TCP 43809 > epmd [ACK] Seq=9 Ack=19 Win=5856 Len=0 TSV=776213773 TSER=1595930818
8 0.001481 server1.net -> server2.net TCP epmd > 43809 [FIN, ACK] Seq=19 Ack=9 Win=5824 Len=0 TSV=1595930818 TSER=776213773
9 0.001623 server2.net -> server1.net TCP 43809 > epmd [FIN, ACK] Seq=9 Ack=20 Win=5856 Len=0 TSV=776213773 TSER=1595930818
10 0.001990 server1.net -> server2.net TCP epmd > 43809 [ACK] Seq=20 Ack=10 Win=5824 Len=0 TSV=1595930818 TSER=776213773
所以在我看来,没有防火墙问题,因为 epmd 实例相互通信。我错过了什么?
非常感谢您的建议!
最好的问候,鲍里斯