[erlang-questions] Distributed Application where its only running if all required Nodes are present
Peer Stritzinger
peerst@REDACTED
Sun Oct 26 09:44:39 CET 2014
FYI: Currently I went away from this distributed application setup.
What I'm doing now is starting the application on each node and
handling the whole distribution aspect myself. Main reason was that I
also need to wait until a certain set of keys are registered in global
before I start the application parts on the respective machines.
I do this with a monitor process which is started at the end of a
all_for_one supervisor which waits until all global required keys are
present, then monitors the remote processes and sends a 'start' message
to its siblings. If any of the remote peers disappears it just crashes
and takes down all siblings with it.
When comming up again it waits again until all required global keys are
present.
With this setup I can easily also have a local fallback application
that takes over when the network is not complete. This can be done by
a protocol between the respective monitors.
BTW this is used for my IEC61499 distributed PLC runtime for context
see my talk http://www.erlang-factory.com/euc2014/peer-stritzinger
Comments wellcome.
Cheers,
-- Peer
On 2014-10-25 15:18:20 +0000, Peer Stritzinger said:
> Hi,
>
> I want to run a application on several nodes at the same time. However
> it only should run on any node if all nodes are present and can
> communicate.
>
> If the node set is not complete, the application should be stopped.
>
> If the node set afterwards is complete again it should be restarted.
>
> Is a behaviour like this doable with OTPs build in distributed applications?
>
> E.g. would something along these lines do what I'm intending?
>
> On node 1:
>
> [{kernel,
> [{distributed, [{myapp, 5000, [node1]}]},
> {sync_nodes_mandatory, [node2, node3]},
> {sync_nodes_timeout, 30000}
> ]}]
>
> On node 2:
>
> [{kernel,
> [{distributed, [{myapp, 5000, [node2]}]},
> {sync_nodes_mandatory, [node1, node3]},
> {sync_nodes_timeout, 30000}
> ]}]
>
> On node 3:
>
> [{kernel,
> [{distributed, [{myapp, 5000, [node3]}]},
> {sync_nodes_mandatory, [node1, node2]},
> {sync_nodes_timeout, 30000}
> ]}]
>
> Cheers,
> -- Peer
More information about the erlang-questions
mailing list