[Erlang] Different Nodes Flashcards
Start a node with a short name
$ erl -sname gandalf
When should you use a short name, and when should you use a long name?
Start Erlang with the -name parameter. When we have two nodes on the
same machine, we use “short” names (as indicated by the -sname flag), but
if they are on different networks, we use -name.
We can also use -sname on two different machines when they are on the
same subnet. Using -sname is also the only method that will work if no
DNS service is available.
Start a node with a long name1
$ erl -name gandalf -setcookie abc
Name 3 things to consider when connecting nodes on two different physical machines
- fully qualified hostnames of each node must be resolvable by DNS
- cookie must be the same
- same version of code and Erlang. Without this, weird and hard to debug errors can occur
Make a call to a remote node with rpc
rpc:call(gandalf@soundwave, ksv, store, [weather, fine]).