Connecting nodes
In this recipe, we will start two different terminal sessions that will be our nodes, and we will connect them.
Getting ready
We will need two terminal windows opened and in each of them, we will create a node.
How to do it…
Start a named node in terminal window one:
> iex --name [email protected] Interactive Elixir (1.0.2) - press Ctrl+C to exit (type h() ENTER for help) iex([email protected])1>
Start another named node in terminal window two:
> iex --name [email protected] Interactive Elixir (1.0.2) - press Ctrl+C to exit (type h() ENTER for help) iex([email protected] )1>
Verify the list of nodes that each of our newly created nodes is aware of:
iex([email protected])1> Node.list [] iex([email protected])1> Node.list []
To connect the two nodes, we will just need to instruct one of them to perform the connection:
iex([email protected])2> Node.connect :"[email protected]" true
Now, confirm that both nodes are connected and aware of each other:
iex([email protected])3> Node.list [:"two...