gmi*_*ile 2 erlang remote-access elixir iex
我在远程计算机上,它上面有一个正在运行的Erlang VM节点.我正在尝试连接到Erlang VM节点,iex但收到错误:
$ iex --name testing@127.0.0.1 --remsh myapp@127.0.0.1 --setcookie NMFJGSU0FwvGKlrqMuGfY1I6LtgSz1Rn2PLiDnqMS54
Erlang/OTP 18 [erts-7.3.1] [source] [64-bit] [async-threads:10] [kernel-poll:false]
Could not contact remote node myapp@127.0.0.1, reason: :nodedown. Aborting...
$
Run Code Online (Sandbox Code Playgroud)
epmd -names 报告Erlang VM节点正在运行:
$ epmd -names
epmd: up and running on port 4369 with data:
name myapp at port 45671
$
Run Code Online (Sandbox Code Playgroud)
以下vm.args是已部署应用的内容:
-name myapp@127.0.0.1
-setcookie NMFJGSU0FwvGKlrqMuGfY1I6LtgSz1Rn2PLiDnqMS54=
-smp auto
Run Code Online (Sandbox Code Playgroud)
问题:我做错了什么?
您需要将相同的cookie传递到iex作为一个在vm.args:
iex --name testing@127.0.0.1 --remsh myapp@127.0.0.1 --cookie NMFJGSU0FwvGKlrqMuGfY1I6LtgSz1Rn2PLiDnqMS54=
Run Code Online (Sandbox Code Playgroud)
如果cookie不正确,您将收到:nodedown错误消息.
来自壳牌#1:
$ iex --cookie foo --name foo@127.0.0.1
Run Code Online (Sandbox Code Playgroud)
来自壳牌#2:
$ iex --name bar@localhost --remsh foo@127.0.0.1
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 foo@127.0.0.1, reason: :nodedown. Aborting...
$ iex --name bar@localhost --remsh foo@127.0.0.1 --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(foo@127.0.0.1)1>
Run Code Online (Sandbox Code Playgroud)