refactor(emqx_conf_cli): rename cluster_call ctl command
Renamed 'clustedr_call' ctl command to 'cluster_sync' as a sub-command of 'conf' The old 'cluster_call' command is kept, but no usage prints
This commit is contained in:
parent
96a41ac6bd
commit
31ab973b30
|
@ -22,11 +22,12 @@
|
|||
unload/0
|
||||
]).
|
||||
|
||||
%% kept cluster_call for compatibility
|
||||
-define(CLUSTER_CALL, cluster_call).
|
||||
-define(CONF, conf).
|
||||
|
||||
load() ->
|
||||
emqx_ctl:register_command(?CLUSTER_CALL, {?MODULE, admins}, []),
|
||||
emqx_ctl:register_command(?CLUSTER_CALL, {?MODULE, admins}, [hidden]),
|
||||
emqx_ctl:register_command(?CONF, {?MODULE, conf}, []).
|
||||
|
||||
unload() ->
|
||||
|
@ -41,17 +42,10 @@ conf(["show", Key]) ->
|
|||
print_hocon(get_config(Key));
|
||||
conf(["load", Path]) ->
|
||||
load_config(Path);
|
||||
conf(["cluster_sync" | Args]) ->
|
||||
admins(Args);
|
||||
conf(_) ->
|
||||
emqx_ctl:usage(
|
||||
[
|
||||
%% TODO add reload
|
||||
%{"conf reload", "reload etc/emqx.conf on local node"},
|
||||
{"conf show --keys-only", "print all keys"},
|
||||
{"conf show", "print all running configures"},
|
||||
{"conf show <key>", "print a specific configuration"},
|
||||
{"conf load <path>", "load a hocon file to all nodes"}
|
||||
]
|
||||
).
|
||||
emqx_ctl:usage(usage_conf() ++ usage_sync()).
|
||||
|
||||
admins(["status"]) ->
|
||||
status();
|
||||
|
@ -87,14 +81,33 @@ admins(["fast_forward", Node0, ToTnxId]) ->
|
|||
emqx_cluster_rpc:fast_forward_to_commit(Node, TnxId),
|
||||
status();
|
||||
admins(_) ->
|
||||
emqx_ctl:usage(
|
||||
emqx_ctl:usage(usage_sync()).
|
||||
|
||||
usage_conf() ->
|
||||
[
|
||||
{"cluster_call status", "status"},
|
||||
{"cluster_call skip [node]", "increase one commit on specific node"},
|
||||
{"cluster_call tnxid <TnxId>", "get detailed about TnxId"},
|
||||
{"cluster_call fast_forward [node] [tnx_id]", "fast forwards to tnx_id"}
|
||||
]
|
||||
).
|
||||
%% TODO add reload
|
||||
%{"conf reload", "reload etc/emqx.conf on local node"},
|
||||
{"conf show --keys-only", "Print all config keys"},
|
||||
{"conf show", "Print config in use"},
|
||||
{"conf show <key>", "Print configs under the given key"},
|
||||
{"conf load <path>",
|
||||
"Load a HOCON format config file."
|
||||
"The config is overlay on top of the existing configs. "
|
||||
"The current node will initiate a cluster wide config change "
|
||||
"transaction to sync the changes to other nodes in the cluster. "
|
||||
"NOTE: do not make runtime config changes during rolling upgrade."}
|
||||
].
|
||||
|
||||
usage_sync() ->
|
||||
[
|
||||
{"conf cluster_sync tatus", "Show cluster config sync status summary"},
|
||||
{"conf cluster_sync skip [node]", "Increase one commit on specific node"},
|
||||
{"conf cluster_sync tnxid <TnxId>",
|
||||
"Display detailed information of the config change transaction at TnxId"},
|
||||
{"conf cluster_sync fast_forward [node] [tnx_id]",
|
||||
"Fast-forward config change transaction to tnx_id on the given node."
|
||||
"WARNING: This results in inconsistent configs among the clustered nodes."}
|
||||
].
|
||||
|
||||
status() ->
|
||||
emqx_ctl:print("-----------------------------------------------\n"),
|
||||
|
|
Loading…
Reference in New Issue