fix issue #121, unload plugins, stop/start gproc app when clustering...
This commit is contained in:
parent
14421dae5b
commit
a7344248e4
|
@ -75,12 +75,21 @@ cluster([SNode]) ->
|
||||||
Node = node_name(SNode),
|
Node = node_name(SNode),
|
||||||
case net_adm:ping(Node) of
|
case net_adm:ping(Node) of
|
||||||
pong ->
|
pong ->
|
||||||
|
case emqttd:is_running(Node) of
|
||||||
|
true ->
|
||||||
|
%%TODO: should not unload here.
|
||||||
|
emqttd:unload_all_plugins(),
|
||||||
application:stop(emqttd),
|
application:stop(emqttd),
|
||||||
application:stop(esockd),
|
application:stop(esockd),
|
||||||
|
application:stop(gproc),
|
||||||
emqttd_mnesia:cluster(Node),
|
emqttd_mnesia:cluster(Node),
|
||||||
|
application:start(gproc),
|
||||||
application:start(esockd),
|
application:start(esockd),
|
||||||
application:start(emqttd),
|
application:start(emqttd),
|
||||||
?PRINT("cluster with ~p successfully.~n", [Node]);
|
?PRINT("cluster with ~p successfully.~n", [Node]);
|
||||||
|
false ->
|
||||||
|
?PRINT("emqttd is not running on ~p~n", [Node])
|
||||||
|
end;
|
||||||
pang ->
|
pang ->
|
||||||
?PRINT("failed to connect to ~p~n", [Node])
|
?PRINT("failed to connect to ~p~n", [Node])
|
||||||
end.
|
end.
|
||||||
|
|
Loading…
Reference in New Issue