如何连接两个Erlang节点? [英] How to connect two erlang nodes?

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

问题描述

有人可以给我更多的可能性来连接两个Erlang节点。
我知道一种使用erlang:set_cookie / 2的方式,并且好奇是否还有另一种方式。

Can someone give me more then one possibility to how to connect two Erlang nodes. I know one way using erlang:set_cookie/2 and curious if there is another way.

推荐答案

1。使用 -setcookie

1. Use -setcookie.

您也可以使用 -setcookie 在执行erlang时

You can also use -setcookie when erlang execute,

在我的本地计算机的第一个终端中,

In first terminal of my local machine,

hyun@hyun-VirtualBox:~$ erl -sname a -setcookie guitar
Erlang/OTP 18 [erts-7.0] [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]

还有我的本地计算机的第二个终端,

And second terminal of my local machine,

hyun@hyun-VirtualBox:~$ erl -sname b -setcookie guitar
Erlang/OTP 18 [erts-7.0] [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]

最后,在第一个终端中,

Lastly, in first terminal,

Eshell V7.0  (abort with ^G)
(a@hyun-VirtualBox)1> net_adm:ping('b@hyun-VirtualBox').
pong

2。复制 $ HOME / .erlang.cookie

2. Copy $HOME/.erlang.cookie

您只需复制 $ HOME / .erlang.cookie 到其他远程PC,以共享相同的Cookie值。

you can just copy $HOME/.erlang.cookie to other remote pc for sharing same cookie value.

另外,您还必须考虑安全性。

Also, you have to think about security.

getting_started


运行erlang时,Erlang节点完全不受保护:set_cookie(node( ),nocookie)。有时,这对于通常不联网的系统或仅出于维护目的而运行的系统是合适的。有关安全系统的详细信息,请参阅auth(3)。

An Erlang node is completely unprotected when running erlang:set_cookie(node(), nocookie). This can sometimes be appropriate for systems that are not normally networked, or for systems which are run for maintenance purposes only. Refer to auth(3) for details on the security system.

这篇关于如何连接两个Erlang节点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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