October 2014
Intermediate to advanced
280 pages
7h 20m
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.
The name that’s returned is an atom—it’s in quotes because it contains characters not allowed in a literal atom.
| | $ iex --sname wobble |
| | iex(wobble@light-boy)> Node.self |
| | :"wobble@light-boy" |
Note that in both cases the iex prompt contains the node’s name along with my machine’s ...
Read now
Unlock full access