Distributed Applications
Vladimir Sekissov
svg@REDACTED
Mon Dec 2 11:06:09 CET 2002
Good day,
For receiving takeover|failover application must be configured with
start_phases parameter.
erlyhack_map_app.app:
{application, erlyhack_map_app,
[{description, "some desc"},
{vsn, "1.0.0"},
{start_phases, [{init, []}, {go, []}]},
...
]
}.
And then in application module
erlyhack_map_app.erl:
start(_, StartArgs) ->
...
start_phase(init, {takeover, FromNode}, Args) ->
%% Here apllication is yet working on second node so we
%% can talk with application processes to get states and
%% get agreement about global names
my_callback_module:perform_takeover(FromNode),
...
ok;
start_phase(init, _, _) -> % Type = normal | {failover, FromNode}
ok;
start_phase(go, _, GoArgs) ->
ok.
Best Regards,
Vladimir Sekissov
hfventer> I have been searching for some answers on distributed applications, but
hfventer> have not yet gotten it to work.
hfventer>
hfventer> Here is what I want to do:
hfventer> I have a simple TCP/IP server that creates a separate process for each
hfventer> connection to the socket. This process then receives commands from the
hfventer> user. These commands are passed on to a central server (possably
hfventer> running on another node) and returns the response to the user. The
hfventer> central server has its own internal stat and recieves commands from
hfventer> other processes.
hfventer>
hfventer> Nothing realy fancy.
hfventer> What I have achieved thusfar is to get my two nodes (windows XP and
hfventer> Linux) to connect. I can start everything on node 2 from node 1 (with a
hfventer> spawn command)
hfventer>
hfventer> I have two applications at the moment. The TCP/IP server and the
hfventer> command server. They both have the application behavior. I created a
hfventer> boot script on both nodes to start these two applications.
hfventer>
hfventer> [{kernel,"2.8.0"},
hfventer> {stdlib,"1.11.0"},
hfventer> {sasl, "1.9.4"},
hfventer> {erlyhack_app,"0.01.02"},
hfventer> {erlyhack_map_app,"0.01.01"}]
hfventer>
hfventer> In my kernel.app file I added the following to both nodes.
hfventer>
hfventer> {distributed, [ {erlyhack_map_app, [n2@REDACTED, n1@REDACTED]} ]},
hfventer> {start_dist_ac, true},
hfventer> {sync_nodes_optional, [n2@REDACTED, n1@REDACTED]},
hfventer> {sync_nodes_timeout, 10000}
hfventer>
hfventer> When I start the nodes up what I get is that all the applications start
hfventer> on the node in question (erlyhack_app and erlyhack_map_app start on n1
hfventer> and then on n2 and continue running there) No takeover of
hfventer> erlyhack_map_app to n2 happens. Clearly I am missing something :)
hfventer>
hfventer> Anyone know what I am doing wrong?
hfventer>
hfventer> I have been searching for complete examples of distributed applications
hfventer> but have not found any. Are there any available for me to look at and
hfventer> learn?
hfventer>
hfventer> Thanks
hfventer>
hfventer> -]-[einrich
hfventer> PS This might be a duplicate message. If it is, my appologies.
More information about the erlang-questions
mailing list