如何在不同平台上连接erlang节点 [英] How to connect erlang nodes on different platforms

查看:113
本文介绍了如何在不同平台上连接erlang节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用erl -name anynode @ hostname将Windows 10上的Erlang节点与freeBSD 10.3 vm上的Erlang节点连接?

How to connect Erlang node on windows 10 with Erlang node on freeBSD 10.3 vm on same machine Using erl -name anynode@hostname?

推荐答案

正如我在评论中写道,您首先需要确定主机(windows)和来宾(FreeBSD VM)之间的内部网络(子网).在Windows上使用 ipconfig ifconfig 命令获取信息.
您可能会注意到,主机中的IP之一与来宾中的IP之一具有相同的前缀,因此这是子网.例如,如果主机的IP为 192.168.2.10 ,而访客的IP为 192.168.2.11 ,则表示 192.168.2.x 是它们之间的网络.现在,我们可以继续连接这些节点.

As I wrote in the comment you first need to determine the internal network (subnet) between the host (windows) and your guest (FreeBSD VM). Use ipconfig on windows and ifconfig commands to get the information.
You will probably notice that one of the IPs in the host has the same prefix as one of the IPs in guest, so this is the subnet. For example, if host has IP 192.168.2.10 and guest has IP 192.168.2.11 meaning that 192.168.2.x is the network between them. Now we can continue to connect those nodes.

有几个简单的步骤:

  1. 输入具有正确IP和通用cookie的shell.
    在Windows上- werl -name windows_node@192.168.2.10 -setcookie'mycookie'.
    在FreeBSD上- erl -name freebsd_node@192.168.2.11 -setcookie'mycookie'.
    您可以在此处和此处阅读有关cookie的更多信息.
  2. 在节点之间连接.可以通过 net_adm:ping/1 net_kernel:connect_node/1 .您只需要从其中一个shell进行操作.示例:
    从Windows Shell- net_adm:ping('freebsd_node@192.168.2.11')
    从Linux Shell- net_kernel:connect_node('windows_node@192.168.2.10')
  3. 您的节点现在应该已连接.您可以通过从任一外壳调用 nodes()来进行检查.
  1. Enter shell with the right IP and a common cookie.
    On Windows - werl -name windows_node@192.168.2.10 -setcookie 'mycookie'.
    On FreeBSD - erl -name freebsd_node@192.168.2.11 -setcookie 'mycookie'.
    You can read more about cookie here and here.
  2. Connect between nodes. This can be done by either net_adm:ping/1 or net_kernel:connect_node/1. You only need to do it from one of the shells. Examples:
    From Windows shell - net_adm:ping('freebsd_node@192.168.2.11')
    From Linux shell - net_kernel:connect_node('windows_node@192.168.2.10')
  3. Your nodes should now be connected. You can check this by calling nodes() from either one of the shells.

这篇关于如何在不同平台上连接erlang节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆