Erlang节点连接问题
努力连接在不同盒子上运行的 2 个节点。尝试过 确保 cookie 同步不存在常见问题, DNS 或防火墙。
首先,我按照 Erlang 文档的建议在调试模式下运行 epmd:
epmd -d -d
然后在框 #1 上:
erl -name [电子邮件受保护] -kernel inet_dist_listen_min 6000 inet_dist_listen_max 6050 -setcookie testcookie
和框#2:
erl -name [电子邮件受保护] -kernel inet_dist_listen_min 6000 inet_dist_listen_max 6050 -setcookie testcookie
ping 失败。例如,在框 #2 上:
Erlang (BEAM) 模拟器版本 5.6.4 [source] [64-bit] [smp:4] [async-threads:0] [kernel-poll:false] Eshell V5.6.4(使用 ^G 中止)
([电子邮件受保护])1> net_adm:ping('[电子邮件受保护]')。
pang
epmd 在 server1.net 上显示以下内容:
epmd: Sun Sep 12 01:40:32 2010: opening file detector 6 上的连接
epmd:2010 年 9 月 12 日星期日 01:40:32:获得 8 个字节
***** 00000000 00 06 7a 78 6d 70 70 31 |..zxmpp1|
epmd:2010 年 9 月 12 日星期日 01:40:32:** 收到 PORT2_REQ
epmd:2010 年 9 月 12 日星期日 01:40:32:获得 18 个字节
***** 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:2010 年 9 月 12 日星期日 01:40:32:** 为“xmpp1”发送 PORT2_RESP(正常)
epmd:Sun Sep 12 01:40:32 2010:关闭文件描述符 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 实例相互通信。我缺少什么?
非常感谢您的建议!
此致, 鲍里斯
Struggling with connecting 2 nodes running on separate boxes. Tried to
make sure that there is no usual problems with cookie synchronization,
DNS or firewall.
First, I run epmd in debug mode as recommended by Erlang docs:
epmd -d -d
Then on box #1:
erl -name [email protected] -kernel inet_dist_listen_min 6000 inet_dist_listen_max 6050 -setcookie testcookie
and on box #2:
erl -name [email protected] -kernel inet_dist_listen_min 6000 inet_dist_listen_max 6050 -setcookie testcookie
No luck with ping. For example, on box #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)
([email protected])1> net_adm:ping('[email protected]').
pang
epmd on server1.net shows following:
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
i.e., appears to receive ping request from second node and respond with ok.
Tshark listening on epmd port (TCP 4369) gives following (I replaced real IPs with server names):
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
So it looks to me that there is no firewall issues, as epmd instances talk to each other. What am I missing?
Your advise is very much appreciated!
Best regards,
Boris
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也是 erlang 的新手,
我的前几个实验是绑定绝对 IP 地址。
如果您通过互联网连接,请确保打开端口inet_dist_listen_min & 中指定inet_dist_listen_max 在您的路由器(应用程序端口)+ epmd 端口中。
服务器1-> router1 端口为 epmd 和 开放应用程序端口
服务器2-> router2 端口为 epmd 和 开放应用程序端口
使用命名空间之前,请先绑定 IP 地址。
I am also a newbie to erlang
My first few experiments were with binding absolute IP address.
If you are connecting over internet make sure that you open ports specified in inet_dist_listen_min & inet_dist_listen_max in your router (app port) + epmd port.
Server1 -> router1 ports open for epmd & app port
Server2 -> router2 ports open for epmd & app port
Please bind over IP address first before using namespace.
原来是防火墙问题。非常感谢迈克尔·桑托斯(Michael Santos),他为我指明了正确的方向。请此处查看他的回答。
Turns out to be a firewall issue. Big thanks to Michael Santos who showed me the right direction. Check out his answer here.