Hey everyone!
I’m trying to connect two nodes together using hostnames (rather than IP) and I keep getting this error:
** System running to use fully qualified hostnames **
** Hostname <hostname> is illegal **
If I use IP addresses rather than hostnames it works.
Any ideas?
2 Likes
Can you provide examples of the host names you’re trying to use?
2 Likes
Sure thing!
Example 1
Node.connect(:"core_repo@core-repo")
Example 2
Node.connect(:"core_repo@corerepo")
idi527
November 21, 2019, 7:28pm
4
anthonator:
Could you please search the codebase for <hostname>
? It might be some default value somewhere. I think I saw it once in the templates distillery generates.
1 Like
I assume the hostnames are valid. They must be FQDN and I think they must resolve to an IP address
1 Like
NobbZ
November 21, 2019, 7:30pm
6
anthonator:
core-repo
It seems as if you started your BEAM in “long name” mode, and in long name mode at least one dot is expected in the hostname to make the BEAM recognize it as “fully qualified”, localhost
might be an exception of this rule, but I’m not quite sure about that.
2 Likes
Sorry, <hostname>
is just a placeholder I used.
I’ve placed the real messages below.
** System running to use fully qualified hostnames **
** Hostname core-repo is illegal **
and
** System running to use fully qualified hostnames **
** Hostname corerepo is illegal **
idi527
November 21, 2019, 7:31pm
8
> iex --name core_repo@core-repo
iex(core_repo@core-repo)1> ...
But then in another terminal
> iex --name core_repo@corerepo
Protocol 'inet_tcp': the name core_repo@corerepo seems to be in use by another Erlang node
So it seems like it’s not possible to run both since the dash -
seems to be removed from core-repo
and it then conflicts with corerepo
…
I’m not running both core-repo
and corerepo
at the same time. I was alternating the use to see if I could get one to work.
Interesting. Putting a .
at the end of the hostname doesn’t cause the error to pop up.
I’ll keep digging here.
To elaborate. core_repo@core_repo
is not a valid name. It is not Fully Qualified Domain Name (https://en.wikipedia.org/wiki/Fully_qualified_domain_name ).
You need something like core_repo@core_repo.yourdomain.com
. And that FQDN must resolve to an IP address of the node you are using so that they can communicate.
That is why IP addresses works.
1 Like
NobbZ
November 21, 2019, 7:38pm
12
On linux systems you can use hostname --fqdn
to learn the fully qualified name of your current host.
1 Like
idi527
November 21, 2019, 7:38pm
13
What if there is an entry for core_repo
in /etc/hosts
?
The BEAM don’t think that is good enough. Funnily enough, If I put
127.0.0.1 core_repo.
in the hosts file. This actually works.
Note the .
on the end.
2 Likes