commit
8bc0d77df6
|
@ -200,6 +200,8 @@ stop_listener({Proto, ListenOn, _Opts}) when Proto == http; Proto == ws ->
|
||||||
mochiweb:stop_http('mqtt:ws', ListenOn);
|
mochiweb:stop_http('mqtt:ws', ListenOn);
|
||||||
stop_listener({Proto, ListenOn, _Opts}) when Proto == https; Proto == wss ->
|
stop_listener({Proto, ListenOn, _Opts}) when Proto == https; Proto == wss ->
|
||||||
mochiweb:stop_http('mqtt:wss', ListenOn);
|
mochiweb:stop_http('mqtt:wss', ListenOn);
|
||||||
|
stop_listener({Proto, ListenOn, _Opts}) when Proto == api ->
|
||||||
|
mochiweb:stop_http('mqtt:api', ListenOn);
|
||||||
stop_listener({Proto, ListenOn, _Opts}) ->
|
stop_listener({Proto, ListenOn, _Opts}) ->
|
||||||
esockd:close(Proto, ListenOn).
|
esockd:close(Proto, ListenOn).
|
||||||
|
|
||||||
|
|
|
@ -330,7 +330,7 @@ bridges(["options"]) ->
|
||||||
?PRINT_MSG(" suffix = string~n"),
|
?PRINT_MSG(" suffix = string~n"),
|
||||||
?PRINT_MSG(" queue = integer~n"),
|
?PRINT_MSG(" queue = integer~n"),
|
||||||
?PRINT_MSG("Example:~n"),
|
?PRINT_MSG("Example:~n"),
|
||||||
?PRINT_MSG(" qos=2,prefix=abc/,suffix=/yxz,queue=1000~n");
|
?PRINT_MSG(" prefix=abc/,suffix=/yxz,queue=1000~n");
|
||||||
|
|
||||||
bridges(["start", SNode, Topic]) ->
|
bridges(["start", SNode, Topic]) ->
|
||||||
case emqttd_bridge_sup_sup:start_bridge(list_to_atom(SNode), list_to_binary(Topic)) of
|
case emqttd_bridge_sup_sup:start_bridge(list_to_atom(SNode), list_to_binary(Topic)) of
|
||||||
|
|
|
@ -50,7 +50,7 @@ prepare() ->
|
||||||
%% @doc Is node in cluster?
|
%% @doc Is node in cluster?
|
||||||
-spec(is_clustered(node()) -> boolean()).
|
-spec(is_clustered(node()) -> boolean()).
|
||||||
is_clustered(Node) ->
|
is_clustered(Node) ->
|
||||||
lists:member(Node, emqttd_mnesia:running_nodes()).
|
lists:member(Node, emqttd_mnesia:cluster_nodes(all)).
|
||||||
|
|
||||||
%% @doc Reboot after join or leave cluster.
|
%% @doc Reboot after join or leave cluster.
|
||||||
-spec(reboot() -> ok).
|
-spec(reboot() -> ok).
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
%% Cluster mnesia
|
%% Cluster mnesia
|
||||||
-export([join_cluster/1, cluster_status/0, leave_cluster/0,
|
-export([join_cluster/1, cluster_status/0, leave_cluster/0,
|
||||||
remove_from_cluster/1, running_nodes/0]).
|
remove_from_cluster/1, cluster_nodes/1, running_nodes/0]).
|
||||||
|
|
||||||
%% Schema and tables
|
%% Schema and tables
|
||||||
-export([copy_schema/1, delete_schema/0, del_schema_copy/1,
|
-export([copy_schema/1, delete_schema/0, del_schema_copy/1,
|
||||||
|
@ -213,10 +213,18 @@ connect(Node) ->
|
||||||
Error -> Error
|
Error -> Error
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% @doc Running nodes
|
%% @doc Running nodes.
|
||||||
-spec(running_nodes() -> list(node())).
|
-spec(running_nodes() -> list(node())).
|
||||||
running_nodes() ->
|
running_nodes() -> cluster_nodes(running).
|
||||||
mnesia:system_info(running_db_nodes).
|
|
||||||
|
%% @doc Cluster nodes.
|
||||||
|
-spec(cluster_nodes(all | running | stopped) -> [node()]).
|
||||||
|
cluster_nodes(all) ->
|
||||||
|
mnesia:system_info(db_nodes);
|
||||||
|
cluster_nodes(running) ->
|
||||||
|
mnesia:system_info(running_db_nodes);
|
||||||
|
cluster_nodes(stopped) ->
|
||||||
|
cluster_nodes(all) -- cluster_nodes(running).
|
||||||
|
|
||||||
%% @private
|
%% @private
|
||||||
ensure_ok(ok) -> ok;
|
ensure_ok(ok) -> ok;
|
||||||
|
|
Loading…
Reference in New Issue