how to use a specific host alias for node name?

RCB <>
Thu Aug 31 20:20:36 CEST 2006


One idea (leveraging the OTP) is to use pg2.    Make the computation nodes
register themselves with pg2, using a pre-defined group name (such as
'comp'.)   Then, from the master server, use pg2:get_members(comp) before
dispatching.   This will return a list of PIDs.   From there you can easily
get node names:

Workers = [node(Pid) || Pid <- pg2:get_members(comp)]

There are other ways, but this is pretty fast, dynamic (if a worker node
goes offline it is instantly reflected via pg2, and it solves the late
master problem you mentioned) and works well in some of the applications
I've written.


On 8/31/06, Garry Hodgson <> wrote:
> in our application, a master server has a list of nodes
> that it can use for computation.  in principle, we'd like
> the machines named node1, node2, ...nodeN, so the nodes
> would be @nodeN.  but some of our
> installations have their own naming conventions for machines.
> adding aliases in /etc/hosts doesn't help.  so we resort to a
> config file, which seems kind of klunky.
> is there a way to cause the nodes to come up using a specific
> host alias?  or better yet, is there a better way for the master to find
> out who's out there?  the nodes check in when they come up,
> but this won't help if they're already up when master starts.
> and no, we're not using otp, alas, though i'd also be interested
> in otp approaches.
> ----
> Garry Hodgson, Senior Software Geek, AT&T CSO
> But I'm not giving in an inch to fear
> 'Cause I promised myself this year
> I feel like I owe someone.

Rich Beerman
Cupertino, California
mobile: 408/221-2444
fax: 408/255-7944
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the erlang-questions mailing list