Erlang邻居搜索
我有几台互连的计算机。每台机器上都运行着 Erlang 节点,我想通过 Erlang 术语(点对点风格)相互通信。但是,只有在我 net_adm:ping
等之后,其他计算机上的节点才会在 nodes()
中列出。有没有什么方法可以找出所有节点(具有相同的节点) cookie)在 LAN 上(并且每台计算机上没有存储邻居列表)?
I have couple of interconnected computers. On every machine there is running Erlang node and I'd like to communicate with each other passing Erlang terms (peer-to-peer style). However nodes on other computers are listed in nodes()
only after I net_adm:ping
ed them etc. Is there any way how to find out what all nodes (with the same cookie) are on LAN (and without having list of neighbours stored on each computer)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
目前 Erlang/OTP 中没有 LAN 发现系统,但有几种方法可以实现:
inet:getif()
以获取 LAN 子网列表,然后调用(net_kernel():epmd_module()):names(IP)
为每个子网中的每个 IP 地址收集正在运行的节点列表,然后 net_adm:ping() 将它们全部连接起来。我认为这假设 DNS 解析正常,以便您可以将 IP 转换为名称,以便 ping 正常工作。 (我对节点连接的确切要求有点生疏)There's no LAN discovery system in Erlang/OTP right now, but there are a few ways you could go about it:
inet:getif()
for a list of LAN subnets, and then call(net_kernel():epmd_module()):names(IP)
for each IP address in each subnet to collect the list of running nodes, then net_adm:ping() them all to connect. I think this assumes that DNS resolution is working so that you can convert the IP to a name so that the ping will work. (I'm a little rusty on the exact requirements for node connections)