Distributed applications

Ulf Wiger etxuwig@REDACTED
Thu Mar 9 13:25:11 CET 2000


> From: Sean Hinde <Sean.Hinde@REDACTED>
> 
> Hi all,
> 
> I have a very simple application containing a single locally registered
> gen_server which I want to make distributed in the splendidly described
> manner of Sam Tardieu for his power outages example.
> 
> I've set up the 'distributed' kernel parameter with my app name and node
> names as per the example and set the start_phases to [] in my .app file:
> 
> {distributed, [{backup, [{test1@REDACTED, {test2@REDACTED, test3@REDACTED}]}]}

The above is not syntactically correct. I assume it should be:

{distributed, [{backup, [test1@REDACTED, {test2@REDACTED, test3@REDACTED}]}]}

That is, run backup primarily on test1, but if it fails, run it on either
test2 or test3.


> All files are generated using the standard skeletons in the emacs-mode with
> 4.9.1.
> 
> If I start with nodes 2 and 3, application:start(backup) hangs on both.
> The app then starts fine on test1, but application:start(backup) remains
> hung on nodes 2 and 3.

Are the nodes in contact with each other?

You need to make sure that you have the following kernel env variables
defined:

{sync_nodes_optional, [test1@REDACTED, test2@REDACTED, test3@REDACTED]}
{sync_nodes_timeout, Timeout}  % you choose the timeout

This can be done via the command-line shell, or in a sys.config.


> Restarting various nodes means I can get the application fully running on
> all nodes at once, which I am not at all sure is the idea of this - is it?

No. This is suggests that your nodes are not talking to each other.


> Do I need to do stuff with start phases or having different behaviour in the
> application file for normal and takeover etc for this simple locally
> registered example?

No, you shouldn't have to muck around with that. The start phases
are good for more complex apps, and their main contribution is 
to bring order into complex start/restart scenarios.

/Uffe

Ulf Wiger, Chief Designer AXD 301         <ulf.wiger@REDACTED>
Ericsson Telecom AB                          tfn: +46  8 719 81 95
Varuvägen 9, Älvsjö                          mob: +46 70 519 81 95
S-126 25 Stockholm, Sweden                   fax: +46  8 719 43 44




More information about the erlang-questions mailing list