Reputation: 1447
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?
Upvotes: 2
Views: 637