toraritte
toraritte

Reputation: 8283

Setting up Erlang node fails with "Can't set long node name! Please check your configuration"

$ erl -name lofa
{error_logger,{{2008,6,18},{21,43,13}},"Can't set long node name! 
\nPlease check your configuration\n",[]}
# ... several stacktrace lines follow ...

Upvotes: 3

Views: 5760

Answers (2)

Adriano Mitre
Adriano Mitre

Reputation: 330

TL;DR Use erl -sname lofa instead of erl -name lofa.

Explanation:

  • --name expects a fully qualified name, i.e., <username>@<host>.
  • --sname accepts a short name, i.e., just the username, inferring the host from hostname -f

Therefore,

iex --sname joe
erl -sname joe

is equivalent to the following

iex --name joe@$(hostname -f)
erl -name joe@$(hostname -f)

I tested the above from Elixir 1.7.4 & Erlang/OTP 22.3.4.20 up to 1.12.1 & Erlang/OTP 24.0.2 (the latest as of this answer).

References:

Upvotes: 4

toraritte
toraritte

Reputation: 8283

Quoting José Valim:

This is likely happening because hostname -f is not returning a value, i.e. your machine doesn't know how it should be named in the network. You can use --sname, give the fullname, like --name foo@IP_ADDRESS or something that makes sense between machines (so they can find each other).

Another solution is to set the hostname directly (sudo hostname <FQDN>), or update the hosts file (e.g., /etc/hosts in Linux).

Upvotes: 3

Related Questions