Erlang: automatically publish .hosts.erlang file?

I use net_adm: world () to connect to hosts on other hosts, but the only way I got this is when I manually created the hosts file and listed the name of another host in the file. If I had 10 hosts, I would put this file on all ten machines and update the list ten times each time a new node is added to the cluster.

Is there a way to automatically update this file every time I connect to Node on a new host?

+7
source share
2 answers

your .hosts.erlang file does not have to be complete or 100% correct. a node only needs to connect to each other to find out about all the other nodes in the cluster.

you can skip saving the .hosts.erlang file and use mutlicast UDP to dynamically detect hosts. See nodefinder for example code.

we started the UDP multicast route, but then decided to just save the central nodes file and use rsync to distribute it to all hosts. we restart nodes infrequently, so this was not a big problem.

+4
source

We use chef to .hosts.erlang file for nodes belonging to the cluster. The net_adm:world() function can be used to determine the nodes that are currently part of a cluster, which does not necessarily correspond to what .hosts.erlang contains, for example, when one of the nodes is omitted. An alternative to using net_adm:world() is the function net_adm:world_list(Hosts) , which takes a list of hosts (instead of reading from .hosts.erlang ) and does the same thing as net_adm:world() to determine which nodes are currently connected.

+1
source

All Articles