Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Erlang neighbour search

Tags:

search

erlang

lan

I have couple of interconnected computers. On every machine there is running Erlang node and I'd like to communicate with each other passing Erlang terms (peer-to-peer style). However nodes on other computers are listed in nodes() only after I net_adm:pinged them etc. Is there any way how to find out what all nodes (with the same cookie) are on LAN (and without having list of neighbours stored on each computer)?

like image 260
Jakub Kulhan Avatar asked Feb 21 '10 02:02

Jakub Kulhan


1 Answers

There's no LAN discovery system in Erlang/OTP right now, but there are a few ways you could go about it:

  • Read inet:getif() for a list of LAN subnets, and then call (net_kernel():epmd_module()):names(IP) for each IP address in each subnet to collect the list of running nodes, then net_adm:ping() them all to connect. I think this assumes that DNS resolution is working so that you can convert the IP to a name so that the ping will work. (I'm a little rusty on the exact requirements for node connections)
  • Run something like nodefinder on each node. Nodefinder is a discovery library that can use multicast udp to discover Erlang nodes on a LAN.
like image 145
archaelus Avatar answered Sep 23 '22 15:09

archaelus