How does EPMD compare node names?

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.

  1. Node B registers itself in epmd as name_bhost_b_port.
  2. Node A asks host_b:epmd_port for port for name_b and saves it under host_b_port.
  3. 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:

  1. Node B is started with name and some “arbitrary” host_b part
  2. 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 under node_b_ip
  3. Node A connects to the node B using name@node_b_ip i.e.
    1. Contact node_b_ip:epmd_port and obtain node_b_port corresponding with name.
    2. Contact Node B using node_b_ip:node_b_port.

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.

2 Likes

Afaik the hostname part of a long name is expected to route to the host where the system is running, so it doesn’t need to be an IP address. An IP address is just the simplest form of routable address, because it doesn’t require a name to IP address mapping/lookup. Especially where with DNSPoll you already get the IP address from the DNS lookup.