Cannot connect Elixir hosts on MacBook Pro

I cannot connect two nodes on my macbook pro. I use iex —sname foo and iex —sname bar in two separate terminal sessions, and they cannot see each other. Ive tried setting up a firewall and completely disabling it with no luck.

From foo, I use Node.self to see the full name :" foo@ewHBook-Pro " , and then from the bar, Im trying both Node.connect :" foo@ewHBook-Pro " and Node.ping :" foo@ewHBook-Pro "

+5
source share
3 answers

Hostname resolution is a bit more complicated in OSX. Try using long names with --name "foo" . If this fails, I will explicitly tell him the host name with which you want to use:

 --name " foo@ `hostname`" 

Now the name will look like :" foo@ewHBook-Pro.local " , and you can use it in Node.connect/1 and Node.ping/1 .

+7
source

This is probably the problem in your hosts file. Check out this pma comment on this GitHub issue .

The solution to this problem used iex --sname foo@localhost and iex --sname bar@localhost .

+2
source
 sudo vi /etc/hosts 

then add the line

 127.0.0.1 macbook 

macbook is the name of your computer.

+1
source

Source: https://habr.com/ru/post/1235900/


All Articles