2
votes

I'm dynamically loading an Erlang application into the system based on a config file which procludes me from starting the distributed app at boot time -- I'm able to get failover to work, but not failback (or in OTP Terms, Takeover.)

Say I have NodeA running the app, and NodeB as a failover node. I pull the cord on NodeA, and the application migrates to NodeB. This is expected. But when I bring NodeA back online and try to call application:start(MyApp) I get:

{error, {shutdown,{myapp, start, [normal,["config.xml"]]}}} Which is indicative of the app failing to start up.

No matter, it fails to start because I have the supervisors running on the other NodeB already, and I've net_adm:ping'ed them together.

I would imagine I can call application:takeover/2 on MyApp to get control back of the node, and kill the application on the other node.

{error,{not_running_distributed, MyApp}}

But this doesn't work either. My Node priority list is [NodeA, {NodeB, NodeC}], so I would think that the app would know to move to the higher priority node once back online.

How do I go about implementing Takeover in this scenario?

1
Also, this first answer stackoverflow.com/questions/6402873/… claims that distributed apps only work as part of a release... but my failover works, just not the failback!batman
Why are you using an XML file for your configuration? I'm sure you could translate it into an erlang-style config, thus allowing you to start it at boot time. Also, XML is terrible.Soup d'Campbells
Integrating with 3rd party components... XMerl works just fine however, and quite functionally.batman
Also, we're distributing the Erlang application. As software.batman
It may help you to know that the application will start fully on the takeover node before being stopped on the running node. If your application is globally registering something it may be failing because it's already registered.Vance Shipley

1 Answers

1
votes

You may need to use application:takeover/2 instead.