5

I am on a remote machine, it has a running Erlang VM node on it. I'm trying to connect to Erlang VM node via iex but get an error back:

$ 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 reports the Erlang VM node is running:

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

Here's the contents of vm.args of a deployed app:

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

Question: what am I doing wrong?

oldhomemovie
  • 14,621
  • 13
  • 64
  • 99

1 Answers1

8

You need to pass the same cookie to iex as the one in vm.args:

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

If the cookie is incorrect, you'll get a :nodedown error.

From Shell #1:

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

From 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>
Dogbert
  • 212,659
  • 41
  • 396
  • 397
  • sorry, I didn't specify it but I was actually passing a cookie. I will update my question. – oldhomemovie Nov 04 '16 at 16:32
  • Did you use `--setcookie` or `--cookie`? It should be `--cookie` for `iex`. And you also seem to have missed the last `=` (or made a typo in the edit). – Dogbert Nov 04 '16 at 16:37
  • you're perfectly right! I completely missed that I used the wrong key. Everything works now, thank you :) P.S. and thanks for pointing out the missing `=` symbol in the end! – oldhomemovie Nov 04 '16 at 17:07