As written in the documentation (and answered in the comments by @Soup d'Campbells), the -sname
and -name
flags do not need the hostname, and will automatically fill the Host
part of the node's ID with the host'sid (short not fully qualified for -sname, FQDN for -name):
-sname Name Makes the Erlang runtime system into a distributed node, similar to -name, but the host name portion of the node name Name@Host
will be the short name, not fully qualified.
This is sometimes the only way to run distributed Erlang if the DNS
(Domain Name System) is not running. There can be no communication
between nodes running with the -sname flag and those running with the
-name flag, as node names must be unique in distributed Erlang systems.
-name Name Makes the Erlang runtime system into a distributed node. This flag invokes all network servers necessary for a node to become
distributed. See net_kernel(3). It is also ensured that epmd runs on
the current host before Erlang is started. See epmd(1).
The name of the node will be Name@Host, where Host is the fully
qualified host name of the current host. For short names, use the
-sname flag instead.
If you plan to use a distributed node, and you do have DNS in your domain, use the -name
flag, as it will also invoke all necessary network servers (just as written above).
See for yourself:
$> erl -sname bouly
(bouly@myserver)1>
$> erl -name bouly
(bouly@myserver.myhome.net)1>