Support for alternative service discovery mechanisms was added in Erlang/OTP 21.
This section describes how to implement an alternative discovery mechanism for Erlang distribution. Discovery is normally done using DNS and the Erlang Port Mapper Daemon (EPMD) for port discovery.
Support for alternative service discovery mechanisms was added in Erlang/OTP 21.
To implement your own service discovery module you have to write your own EPMD module. The EPMD module
is responsible for providing the location of another node. The distribution modules (inet_tcp_dist
/inet_tls_dist
) call the EPMD module to get the IP address and port of the other node. The EPMD module that is part of Erlang/OTP will resolve the hostname using DNS and uses the EPMD unix process to get the port of another node. The EPMD unix process does this by connecting to the other node on a well-known port, port 4369.
The discovery module needs to implement the same API as the regular EPMD module
. However, instead of communicating with EPMD you can connect to any service to find out connection details of other nodes. A discovery module is enabled by setting -epmd_module
when starting erlang. The discovery module must implement the following callbacks:
start_link/0
names/1
register_node/2
port_please/3
The discovery module may implement the following callback:
address_please/3
Return the address of the given node. If not implemented, inet:gethostbyname/1
will be used instead
This callback may also return the port of the given node. In that case port_please/3
may be omitted.
© 2010–2017 Ericsson AB
Licensed under the Apache License, Version 2.0.