May 2018
Intermediate to advanced
412 pages
9h 3m
English
So far we haven’t needed to give our node a name—we’ve had only one. If we ask Elixir what the current node is called, it’ll give us a made-up name:
| | iex> Node.self |
| | :nonode@nohost |
We can set the name of a node when we start it. With IEx, use either the --name or --sname option. The former sets a fully qualified name:
| | $ iex --name wibble@light-boy.local |
| | iex(wibble@light-boy.local)> Node.self |
| | :"wibble@light-boy.local" |
The latter sets a short name:
| | $ iex --sname wobble |
| | iex(wobble@light-boy)> Node.self |
| | :"wobble@light-boy" |
The name that’s returned is an atom—it’s in quotes because it contains characters not allowed in a literal atom.
Note that in both cases the IEx prompt contains the node’s name along ...
Read now
Unlock full access