【问题标题】:Connecting to a remote node连接到远程节点
【发布时间】:2017-03-18 13:44:33
【问题描述】:

我在一台远程机器上,它上面有一个正在运行的 Erlang VM 节点。我正在尝试通过iex 连接到 Erlang VM 节点,但返回错误:

$ 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...
$

epmd -names 报告 Erlang VM 节点正在运行:

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

这是已部署应用的vm.args 的内容:

-name myapp@127.0.0.1
-setcookie NMFJGSU0FwvGKlrqMuGfY1I6LtgSz1Rn2PLiDnqMS54=
-smp auto

问题:我做错了什么?

【问题讨论】:

    标签: erlang elixir remote-access elixir-iex


    【解决方案1】:

    您需要将与vm.args 中的cookie 相同的cookie 传递给iex

    iex --name testing@127.0.0.1 --remsh myapp@127.0.0.1 --cookie NMFJGSU0FwvGKlrqMuGfY1I6LtgSz1Rn2PLiDnqMS54=
    

    如果 cookie 不正确,您将收到 :nodedown 错误。

    从 Shell #1:

    $ iex --cookie foo --name foo@127.0.0.1
    

    从 Shell #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>
    

    【讨论】:

    • 对不起,我没有指定它,但我实际上是在传递一个 cookie。我会更新我的问题。
    • 您使用的是--setcookie 还是--cookie?对于iex,它应该是--cookie。而且您似乎也错过了最后一个=(或在编辑中打错了字)。
    • 你完全正确!我完全错过了我用错了钥匙。现在一切正常,谢谢:)最后感谢您指出缺少的= 符号!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-03-26
    • 2013-11-29
    • 1970-01-01
    • 1970-01-01
    • 2011-01-23
    • 1970-01-01
    • 2022-11-15
    相关资源
    最近更新 更多