Reputation: 500
I am trying to connect 2 nodes of different docker containers.
Container1: iex --name [email protected] --cookie foo
Container2: iex --name [email protected] --cookie foo
Now lets say I want to connect to [email protected]
from [email protected]
Container2:
iex([email protected])> Node.connect(:"[email protected]")
iex([email protected])> true
Nodes are getting connected. But if I do
iex([email protected])> node = "[email protected]"
iex([email protected])> Node.connect(:node)
iex([email protected])> false
Why I am getting error? This is happening with other functions as well such as Node.spawn/2.
Upvotes: 4
Views: 845
Reputation: 500
I got it working by converting the string into atom.
iex([email protected])> node = "[email protected]"
iex([email protected])> Node.connect(String.to_atom(node))
iex([email protected])> true
Upvotes: 2