Hi,
assuming we define a full node name as name@host
, how does the EPMD compare two node names?
Does it take into account both parts i.e. name
and host
or only name
.
My current understanding is as follows. We have node A and we want to connect it to node B with name name_b@host_b
.
- Node B registers itself in epmd as
name_b
→host_b_port
. - Node A asks
host_b:epmd_port
for port forname_b
and saves it underhost_b_port
. - Node A contacts
host_b:host_b_port
.
Because node B can listen to 0.0.0.0
, there is no need to store host_b
in EPMD.
However, epmd docs says:
The name and address are sent to the epmd daemon running on the local host. In a TCP/IP
environment, the address consists of the IP address and a port number.
The node name is an atom on the form of Name@Node. The job of the epmd daemon is to keep track of which node name listens on which address.
Hence, epmd maps symbolic node names to machine addresses.
So not only do we store host
part of the node name (refered in docs as Node
) but also some ip address?
Context
I am asking in the context of DNS. So we want to use DNS clustering strategy from libcluster
(see here) but they require our nodes to be named <name>@<ip-address>
.
So we assume that EPMD uses very strict name comparision i.e. when we ask EPMD for host_b_port
we pass it the whole node name so name_b@host_b
, where host_b
, in the case of DNS, has to be an IP address (not sure why it can’t be domain name?)
What I would like to achieve is something like this:
- Node B is started with
name
and some “arbitrary”host_b
part - Node A is started with the same
name
as Node B and some other, “arbitrary”host_a
part, sends a query to the DNS server, obtains Node B ip address and saves it undernode_b_ip
- Node A connects to the node B using
name@node_b_ip
i.e.- Contact
node_b_ip:epmd_port
and obtainnode_b_port
corresponding withname
. - Contact Node B using
node_b_ip:node_b_port
.
- Contact
So we basically don’t need to use host
part of the node name.
The bigger context is that when I start my service via Docker, I don’t know yet its IP address i.e. I cannot pass it via environment variable to configure the distribution.