[erlang-questions] how: distributed supervision tree

Ulf Wiger (TN/EAB) ulf.wiger@REDACTED
Wed Nov 28 09:42:07 CET 2007

Zvi skrev:
> Ulf,
> So what you suggesting, is to use "forest" of the single-node supervision
> "trees".
> Then the "forester" or "woodward" will monitor, and start/restart/shut the
> top-level supervisor in each "tree". Such a "forester" can't use Erlang's
> built-in trap-exit/process linking mechanism and should reimplement
> distributed version of it.
> Thanks,
> Zvi

A supervision tree is usually encapsulated within an application.
Through OTP's release handling framework, you can build a boot script
that loads all the code(*) and starts the applications you need.

You can specify where each application should run in a distributed
system. It is most common to run the same boot script on each node,
and then configure the kernel application to start the right
applications. If the system is supposed to recover automatically,
you should make sure that the erlang node is supervised and
restarted, if it dies. This can be done in different ways.

You specify distribution logic e.g. in a sys.config file, which is 
identified with the -sys parameter when starting erlang.

An example sys.config:

      [{a, [node@REDACTED, node@REDACTED]}]

This would tell the distributed application controller to start the
application 'a' on node@REDACTED, if available, otherwise on node@REDACTED
If the node running the application dies, the controller will move it
to an alternative node.

You can read more about it on the man pages for 'kernel' and 
'application' (and 'erl', if you want to read more about command-
line arguments).

Ulf W

More information about the erlang-questions mailing list