ewH
ewH

Reputation: 2683

Cannot connect Elixir nodes on MacBook Pro

I can’t seem to connect two nodes on my macbook pro. I am using iex —sname foo and iex —sname bar in two separate terminal sessions and they can’t see each other. I’ve tried setting the firewall and turning it off completely with no luck.

From foo, I am using Node.self to see that the full name is :"foo@ewHBook-Pro" and then from bar, I’m trying both Node.connect :"foo@ewHBook-Pro" and Node.ping :"foo@ewHBook-Pro"

Upvotes: 5

Views: 680

Answers (3)

LJZN
LJZN

Reputation: 11

sudo vi /etc/hosts

then add a line

127.0.0.1    macbook

the macbook is your computer name.

Upvotes: 1

zyro
zyro

Reputation: 86

Hostname resolution is a bit tricky on OSX. Try using long names with --name "foo". If that fails, explicitly tell it the hostname you want to use with:

--name "foo@`hostname`"

The name will then be something like :"[email protected]" and you can use that in Node.connect/1 and Node.ping/1.

Upvotes: 7

Gazler
Gazler

Reputation: 84150

This is likely an issue in your hosts file. Check out this comment by pma on this GitHub issue.

The solution on the issue was using iex --sname foo@localhost and iex --sname bar@localhost.

Upvotes: 2

Related Questions