Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
bd5af03d
Commit
bd5af03d
authored
Dec 03, 2017
by
Itamar Haber
Browse files
Adds help to `CLUSTER` command
parent
ee3884e6
Changes
1
Show whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
bd5af03d
...
@@ -4065,7 +4065,34 @@ void clusterCommand(client *c) {
...
@@ -4065,7 +4065,34 @@ void clusterCommand(client *c) {
return;
return;
}
}
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"meet"
)
&&
(
c
->
argc
==
4
||
c
->
argc
==
5
))
{
if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"help")) {
const char *help[] = {
"addslots <slot> [slot ...] -- Assign slots to current node.",
"bumpepoch -- Advance the cluster config epoch.",
"count-failure-reports <node-id> -- Return number of failure reports for <node-id>.",
"countkeysinslot <slot> - Return the number of keys in <slot>.",
"delslots <slot> [slot ...] -- Delete slots information from current node.",
"failover [force|takeover] -- Promote current slave node to being a master.",
"forget <node-id> -- Remove a node from the cluster.",
"getkeysinslot <slot> <count> -- Return key names stored by current node in a slot.",
"flushslots -- Delete current node own slots information.",
"info - Return onformation about the cluster.",
"keyslot <key> -- Return the hash slot for <key>.",
"meet <ip> <port> [bus-port] -- Connect nodes into a working cluster.",
"myid -- Return the node id.",
"nodes -- Return cluster configuration seen by node. Output format:",
" <id> <ip:port> <flags> <master> <pings> <pongs> <epoch> <link> <slot> ... <slot>",
"replicate <node-id> -- Configure current node as slave to <node-id>.",
"reset [hard|soft] -- Reset current node (default: soft).",
"set-config-epoch <epoch> - Set config epoch of current node.",
"setslot <slot> (importing|migrating|stable|node <node-id>) -- Set slot state.",
"slaves <node-id> -- Return <node-id> slaves.",
"slots -- Return information about slots range mappings. Each range is made of:",
" start, end, master and replicas IP addresses, ports and ids",
NULL
};
addReplyHelp(c, help);
} else if (!strcasecmp(c->argv[1]->ptr,"meet") && (c->argc == 4 || c->argc == 5)) {
/* CLUSTER MEET <ip> <port> [cport] */
/* CLUSTER MEET <ip> <port> [cport] */
long long port, cport;
long long port, cport;
...
@@ -4258,7 +4285,7 @@ void clusterCommand(client *c) {
...
@@ -4258,7 +4285,7 @@ void clusterCommand(client *c) {
clusterAddSlot(n,slot);
clusterAddSlot(n,slot);
} else {
} else {
addReplyError(c,
addReplyError(c,
"Invalid CLUSTER SETSLOT action or number of arguments"
);
"Invalid CLUSTER SETSLOT action or number of arguments
. Try CLUSTER help
");
return;
return;
}
}
clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG|CLUSTER_TODO_UPDATE_STATE);
clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG|CLUSTER_TODO_UPDATE_STATE);
...
@@ -4608,7 +4635,9 @@ void clusterCommand(client *c) {
...
@@ -4608,7 +4635,9 @@ void clusterCommand(client *c) {
clusterReset(hard);
clusterReset(hard);
addReply(c,shared.ok);
addReply(c,shared.ok);
} else {
} else {
addReplyError
(
c
,
"Wrong CLUSTER subcommand or number of arguments"
);
addReplyErrorFormat(c, "Unknown subcommand or wrong number of arguments for '%s'. Try CLUSTER help",
(char*)c->argv[1]->ptr);
return;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment