Using failover

Samuel Tardieu <>
Thu Feb 10 17:29:45 CET 2000

Due to major power trouble in my building, I built an application to
monitor those power failures. Since this application needs to be
fault tolerant, as its results are used by the technicians working on
the power outages, I use the "distributed" kernel parameter.

It is not clear to me what I should do in takeover mode. My
application is mainly a globally registered gen_server. How can I
cleanly shut down the server running on the other node (the one I'm
taking over) and make sure it is done before starting the application
locally? Won't this create a race condition where the application
won't be restarted if the top-priority node dies after stopping the
application on the remote node and before registering the new process

Note: I have no state to transfer between the node being taken over
and the newly started one as everything is stored in a distributed
Mnesia table.

Thanks in advance for your explanations :)

Samuel Tardieu -- 

My application file is really simple, but the takeover alternative
won't work as a server will be multiply registered.

-module (pomonitor_app).

-behaviour (application).
-export ([start/2, stop/1]).

start (normal, _) ->
    pomonitor_sup:start_link ();

start ({failover, _}, _) ->
    pomonitor_sup:start_link ();

start ({takeover, _}, _) ->
    pomonitor_sup:start_link ().

stop (_) -> ok.

More information about the erlang-questions mailing list