[erlang-questions] Distributed Applications: Stop Before Start?

Ulf Wiger ulf@REDACTED
Tue Mar 27 16:29:03 CEST 2012


In the start_phase() call, you can make a gen_server call to the foo_app
instance running on a and ask it to close its connections.

If that's what you're already doing, perhaps I misunderstood the question?

BR,
Ulf W

On 27 Mar 2012, at 07:01, Vance Shipley wrote:

> Is there a clever way to get "stop first" semantics out of dist_ac?
> 
> A distributed application in OTP may migrate from a failed node
> to another and it may migrate back when the original node returns.
> 
> You can initiate a transfer with application:permit(foo, false).
> The order of the callbacks is:
> 
>   a@REDACTED                  b@REDACTED
>   ---------------------   -------------------
>                           foo_app:start({takeover, a@REDACTED}, [])
>                           foo_app:start_phase(phase1, {takeover, a@REDACTED}, [])
>                           foo_app:start_phase(phase2, {takeover, a@REDACTED}, [])
>   foo_app:prep_stop([])
>   foo_app:stop([])
> 
> Only the start/2 and stop/1 callbacks are required, the others are optional.
> 
> I'm currently trying to distribute OTP's snmp application between two
> nodes on the same host but it fails in the situation above because it
> tries to bind to the address already in use:
> 
>     ** Configuration error: failed starting net-if: 
>     {udp_open,161,eaddrinuse}
> 
> So in this case I'd like to have the application stopped on the old
> node before it is started on the new node.
> 
> -- 
> 	-Vance
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list