epmd -names
and - oh, horror! - get an empty list.node@host
notation to communicate with each other, physically, each node (read, the system process) opens a random high port for this. The task of the epmd
service is to interconnect logical addressing by name and physical addressing by port number. A kind of DNS analogue, with the difference that without the registry the epmd
cluster on the Erlang is falling apart into a handful of individual deaf-and-dumb nodes - which is what has just happened for some mysterious reason. You can, of course, start looking for the guilty, but at first it would be nice to lift the system into place.epmd
supposedly enough to throw only one correct package; For example, we quickly need to program a C program ... Well, we don’t have to go to a low level, it does a good job with sockets and on the Erlang itself, but it would be even easier. It would be desirable - please: we come across the erl_epmd module and we see in it - glory to open source codes! - the magic function register_node/2
, which accepts the node name and port number.netstat
we will find out which port is used by our application - let it be 23456 - and run the emulator in the terminal:$ erl
erl_epmd
) can be done only once per launch.> erl_epmd:start().
> erl_epmd:register_node( ejabberd, 23456 ).
epmd -names
and rada again ...epmd
accepts the registration of any free name on any earl port used, it also remembers from which connection this registration request came, and as soon as the connection has fallen off, the name will be released again. Therefore, now for the correct operation of the system, it is necessary to leave an unnecessary temporary emulator running. Disorder? Disorder. We should somehow get inside the application and call register_node
from there ...$ erl -sname repair
repair@hostname> net_adm:ping( ejabberd@hostname ).
epmd
registry epmd
no longer needed to communicate with it. Therefore, we now go back to the first emulator and nail it down:> halt().
epmd
, and he released the name ejabberd
for re-registration. (Look again at epmd -names
if you do not believe.)rpc
module, go to the application node and brilliantly end a simultaneous game session on three processes:repair@hostname> rpc:call( ejabberd@hostname, erl_epmd, register_node, [ejabberd, 23456] ).
repair@hostname> halt().
Source: https://habr.com/ru/post/49535/
All Articles