Book Image

Elixir Cookbook

By : Paulo Pereira
Book Image

Elixir Cookbook

By: Paulo Pereira

Overview of this book

Table of Contents (16 chapters)
Elixir Cookbook
About the Author
About the Reviewers

Creating named nodes

Until now, we have been using our IEx sessions without naming them. You may notice this because the prompt for the IEx terminal session only has this indication: iex(1)>. The IEx session is a node, and if we run two or more different nodes, even on the same machine, we are running multiple instances of the Erlang virtual machine.

Using two nodes on the same machine or two nodes on different machines is exactly the same thing, apart from connection latency, and that is why there is a need to connect them securely.

By executing several nodes, we are paving the way for distribution and fault tolerance. At this point, we will be focusing on the task of naming our nodes to make them easier to access.

Getting ready

In this recipe, we will be creating nodes with a short name and with a full name as well. Usually, short names are the option when the nodes are in the same network, and long names are the option when we need to create nodes that will interconnect within different...