连接到远程节点

问题描述:

我在远程计算机上,它上面有一个正在运行的Erlang VM节点。我试图通过iex连接到二郎山VM节点,但得到一个错误回来:连接到远程节点

$ iex --name [email protected] --remsh [email protected] --setcookie NMFJGSU0FwvGKlrqMuGfY1I6LtgSz1Rn2PLiDnqMS54 
Erlang/OTP 18 [erts-7.3.1] [source] [64-bit] [async-threads:10] [kernel-poll:false] 

Could not contact remote node [email protected], reason: :nodedown. Aborting... 
$ 

epmd -names报告二郎山VM节点正在运行:

$ epmd -names 
epmd: up and running on port 4369 with data: 
name myapp at port 45671 
$ 

这里的部署应用程序的vm.args内容:

-name [email protected] 
-setcookie NMFJGSU0FwvGKlrqMuGfY1I6LtgSz1Rn2PLiDnqMS54= 
-smp auto 

问题:我做错了什么?

您需要将相同的cookie传递到iex作为一个在vm.args

iex --name [email protected] --remsh [email protected] --cookie NMFJGSU0FwvGKlrqMuGfY1I6LtgSz1Rn2PLiDnqMS54= 

如果cookie不正确,你会得到一个:nodedown错误。

从壳牌#1:

$ iex --cookie foo --name [email protected] 

从壳牌#2:

$ iex --name [email protected] --remsh [email protected] 
Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace] 

Could not contact remote node [email protected], reason: :nodedown. Aborting... 
$ iex --name [email protected] --remsh [email protected] --cookie foo 
Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace] 

Interactive Elixir (1.3.4) - press Ctrl+C to exit (type h() ENTER for help) 
iex([email protected])1> 
+0

对不起,我没有具体说明,但实际上,我是路过的cookie。我会更新我的问题。 – gmile

+0

你使用过'--setcookie'还是'--cookie'?它应该是'--cookie'用于'iex'。而且你似乎也错过了最后一个'='(或者在编辑中犯了一个错字)。 – Dogbert

+0

你完全正确!我完全错过了我使用了错误的钥匙。现在一切正常,谢谢你:) P.S.并感谢您指出缺少的'='符号! – gmile