有人可以为我提供更多关于如何连接两个Erlang节点的可能性.我知道使用erlang的一种方法:set_cookie/2并且如果有另一种方式则很好奇.
1.使用-setcookie.
你也可以-setcookie在erlang执行时使用,
在我本地机器的第一个终端,
hyun@hyun-VirtualBox:~$ erl -sname a -setcookie guitar
Erlang/OTP 18 [erts-7.0] [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]
Run Code Online (Sandbox Code Playgroud)
我本地机器的第二个终端,
hyun@hyun-VirtualBox:~$ erl -sname b -setcookie guitar
Erlang/OTP 18 [erts-7.0] [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]
Run Code Online (Sandbox Code Playgroud)
最后,在第一个终端,
Eshell V7.0 (abort with ^G)
(a@hyun-VirtualBox)1> net_adm:ping('b@hyun-VirtualBox').
pong
Run Code Online (Sandbox Code Playgroud)
2.复制 $HOME/.erlang.cookie
您可以复制$HOME/.erlang.cookie到其他远程PC以共享相同的cookie值.
此外,你必须考虑安全性.
运行erlang时,Erlang节点完全不受保护:set_cookie(node(),nocookie).这有时适用于通常不联网的系统,或仅适用于维护目的的系统.有关安全系统的详细信息,请参阅auth(3).