[erlang-questions] Dynamically add node to Distributed Application

黃耀賢 (Yau-Hsien Huang) g9414002.pccu.edu.tw@REDACTED
Fri Sep 3 03:21:56 CEST 2010

Hi, Steve!

I'm a EC2 noob. But I recently wrote somethings in HP high performance
I have a monitoring module that takes all working nodes in the cluster. Part
of code

loop(Pid, NStates) ->
{Pid, get_nodes} ->
    Pid ! [ N || N <- NStates, is_atom(N) ],
    loop(Pid, NStates);
{Pid, refresh} ->
    manage(Pid, NStates);
{Pid, stop} ->
    [ slave:stop(N) || N <- NStates, is_atom(N) ],
    Pid ! ok,

First it starts a process that end with keeping the loop. The loop knows
the PID of the master node and a list of node states, NStates, that contains
either NodeNames or {idle, NodeNames}. Then when I want
to add a node, it may be a new request such as

        {Pid, add_nodes, ListOfIdleNodes} ->
            loop(Pid, NStates ++ ListOfIdleNodes);

ListOfIdleNodes contains a set of {idle, NodeName}. After adding nodes
by sending this message, the master node shell send refresh command
and new nodes may work.

Best regards,

On Fri, Sep 3, 2010 at 5:09 AM, Steve Strong <steve@REDACTED> wrote:

> Hi,
> I'm working on the design of an Erlang based system which will be hosted on
> EC2.  Right now, a distributed application with a set of nodes looks like
> the right way forward, but one of my requirements is to be able to
> dynamically spin up new amazon instances and add them to the nodes within
> the distributed app.
> However, I can't see a way of adding nodes to a running distributed app - I
> am, however, a self-confessed Erlang noob, so any pointers would be much
> appreciated!
> Cheers,
> Steve

More information about the erlang-questions mailing list