Distributed application problem
Paul Oliver
puzza007@REDACTED
Mon Oct 11 20:12:12 CEST 2010
Hi all,
I'm having a problem with a distributed application where my app ends
up running on two nodes. I've set up a test application using
http://www.erlang.org/doc/design_principles/distributed_applications.html
as a guide. The app is a simple dummy app that does nothing but
start. The config files are as described in §9.2:
puzza@REDACTED:~/src/distr_test$ cat config/distr_test_cp[123].config
%%-*-erlang-*-
[
{kernel,
[{distributed, [{distr_test, 5000, [cp1@REDACTED, {cp2@REDACTED,
cp3@REDACTED}]}]},
{sync_nodes_mandatory, [cp2@REDACTED, cp2@REDACTED]},
% {sync_nodes_optional, [cp2@REDACTED, cp2@REDACTED]},
{sync_nodes_timeout, 5000}
]
}
].
%%-*-erlang-*-
[
{kernel,
[{distributed, [{distr_test, 5000, [cp1@REDACTED, {cp2@REDACTED,
cp3@REDACTED}]}]},
{sync_nodes_mandatory, [cp1@REDACTED, cp3@REDACTED]},
% {sync_nodes_optional, [cp1@REDACTED, cp3@REDACTED]},
{sync_nodes_timeout, 5000}
]
}
].
%%-*-erlang-*-
[
{kernel,
[{distributed, [{distr_test, 5000, [cp1@REDACTED, {cp2@REDACTED,
cp3@REDACTED}]}]},
{sync_nodes_mandatory, [cp1@REDACTED, cp2@REDACTED]},
% {sync_nodes_optional, [cp1@REDACTED, cp2@REDACTED]},
{sync_nodes_timeout, 5000}
]
}
].
I'm starting the three nodes using:
erl -sname cp1 -config config/distr_test_cp1 -pa ebin/
erl -sname cp2 -config config/distr_test_cp2 -pa ebin/
erl -sname cp3 -config config/distr_test_cp3 -pa ebin/
Then starting the app separately on all three nodes with
application:start(distr_test). Now when I stop cp1 and cp2 the
application is transferred to cp3 as expected. However, when I
restart cp1 and cp2 along with the application, I find that it's
running on both cp1 and cp3:
(cp1@REDACTED)2> application:which_applications().
[{distr_test,"Distribution Test","0.1"},
{stdlib,"ERTS CXC 138 10","1.17.1"},
{kernel,"ERTS CXC 138 10","2.14.1"}]
(cp1@REDACTED)3>
(cp2@REDACTED)2> application:which_applications().
[{stdlib,"ERTS CXC 138 10","1.17.1"},
{kernel,"ERTS CXC 138 10","2.14.1"}]
(cp2@REDACTED)3>
(cp3@REDACTED)2> application:which_applications().
[{distr_test,"Distribution Test","0.1"},
{stdlib,"ERTS CXC 138 10","1.17.1"},
{kernel,"ERTS CXC 138 10","2.14.1"}]
(cp3@REDACTED)3>
I note that when I run start on cp1 it's a normal start rather than a
takeover. Can anybody tell me what I'm doing wrong?
Regards,
Paul.
More information about the erlang-questions
mailing list