[CLARIFY]: starting application as permanent and takeover frequency
Tue Feb 23 13:50:31 CET 2010
Is there way to start an application as permanent other than directly by application:start(Application, permanent)? I couldn't find a way to put 'permanent' to .app or .config files to make application controller start the application as permanent. Nor can one seem to give permanent option directly as command line argument. The way I thought to start an application as permanent from command line was to introduce extra starting function to application_app.erl file, which in turn calls application:start(Application, permanent).
This seems to work nicely from command line, but aren't there way to give this option in configuration files? Apparently one can hack the .script file as in http://www.lshift.net/blog/2009/09/30/erlang-otp-boot-files-for-fun-and-profit but that seems bit tedious and requires doing (and understanding) the whole release cycle. Perhaps it would be time to study the release tutorial in more depth.
Now, after starting application as permanent, suppose I want it to be distributed as shown in Ulf's release tutorial. Let's further assume that I've hacked the .script file so that the node taking over starts the application as permanent too. Now, say that there's an external service (possibly replicated, but could still be unavailable) that our application connects to. If the connection is lost, our application tries to resolve the situation by restarting itself. If the connection cannot be restored after few restarts the application finally dies if the restart frequency is exceeded.
I suppose, at that moment the dist_ac starts the application in another node and the process repeats if the connection is not established. Will this result in ping-pong with the nodes, if the nodes are restarted by heart after crash?
Feel free to point me to documentation if I've missed something, but further ideas for implementing HA application would be greatly appreciated!
More information about the erlang-questions