I am running an Elixir app on my 3 servers. I recently needed to connect nodes so that I can sync something between them, and for that I set short names for each node.
I am using Edeliver/Distillery to generate release and deploy. I copied var/vm.args
to release directory on each node and changed -name blah@ip
to -sname name@nodename
. Nodes can see and connect to each other without problem.
Before I given each node a name, I used ssh to remotely connect to my nodes when I needed to debug my app. I used this approach:
ssh node -L 4369:127.0.0.1:4369
- run
epmd -names
on my local machine to find out port of my app - kill last ssh and run
ssh node -L 4369:127.0.0.1:4369 -L port:127.0.0.1:port
to have access to running node on my machine - run
iex --hidden --erl '-name debug -setcookie cookie_like_server'
on my machine - now I had access to remote node, e.g. I could use
observer
to see my remote node
The same procedure won't work now.
First I see an error saying nodes using short and long names cannot connect to each other, obviously.
I changed my iex
command to iex --hidden --erl '-sname debug -setcookie cookie_like_server'
to use short name. This way connection times out when I try to connect to remote node on observer
.
I don't really get the problem. Am I doing something wrong? Is here another way to get access to a running node that uses short name?
BTW, I used ssh so that my traffic will be encrypted. Please do tell me if there is a solution that makes my connection non-encrypted, though I will probably not use it, or somehow tunnel it through ssh.
UPDATE
I tried method suggested by @christophe-de-troyer. TLDR, didn't work.
vahid@arch-adtube ~/ % iex --sname debug --cookie 'cookie' --remsh backend-platform@prod-1
Erlang/OTP 20 [erts-9.0.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]
Could not contact remote node backend-platform@prod-1, reason: :nodedown. Aborting...
ssh prod-1 -L 4369:127.0.0.1:4369
was running, and epmd -names
reports backend-platform
as a running node correctly.