summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWen Hui <wen.hui.ware@gmail.com>2020-08-08 15:28:44 -0400
committerGitHub <noreply@github.com>2020-08-08 12:28:44 -0700
commitca95b71f67f72e41b05dc155ae015f1ad1f16b4c (patch)
tree701ac3de21fb2d24e9618658a408e67b57bb7c28
parent6dcc6898beaadac39a8eb758cbf27e2aa5386831 (diff)
downloadredis-ca95b71f67f72e41b05dc155ae015f1ad1f16b4c.tar.gz
add sentinel command help (#7579)
-rw-r--r--src/sentinel.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/sentinel.c b/src/sentinel.c
index 5bd594955..d93b26131 100644
--- a/src/sentinel.c
+++ b/src/sentinel.c
@@ -3044,7 +3044,30 @@ int sentinelIsQuorumReachable(sentinelRedisInstance *master, int *usableptr) {
}
void sentinelCommand(client *c) {
- if (!strcasecmp(c->argv[1]->ptr,"masters")) {
+ if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"help")) {
+ const char *help[] = {
+"MASTERS -- Show a list of monitored masters and their state.",
+"MASTER <master-name> -- Show the state and info of the specified master.",
+"REPLICAS <master-name> -- Show a list of replicas for this master and their state.",
+"SENTINELS <master-name> -- Show a list of Sentinel instances for this master and their state.",
+"IS-MASTER-DOWN-BY-ADDR <ip> <port> <current-epoch> <runid> -- Check if the master specified by ip:port is down from current Sentinel's point of view.",
+"GET-MASTER-ADDR-BY-NAME <master-name> -- Return the ip and port number of the master with that name.",
+"RESET <pattern> -- Reset masters for specific master name matching this pattern.",
+"FAILOVER <master-name> -- Manually failover a master node without asking for agreement from other Sentinels",
+"PENDING-SCRIPTS -- Get pending scripts information.",
+"MONITOR <name> <ip> <port> <quorum> -- Start monitoring a new master with the specified name, ip, port and quorum.",
+"FLUSHCONFIG -- Force Sentinel to rewrite its configuration on disk, including the current Sentinel state.",
+"REMOVE <master-name> -- Remove master from Sentinel's monitor list.",
+"CKQUORUM <master-name> -- Check if the current Sentinel configuration is able to reach the quorum needed to failover a master "
+"and the majority needed to authorize the failover.",
+"SET <master-name> <option> <value> -- Set configuration paramters for certain masters.",
+"INFO-CACHE <master-name> -- Return last cached INFO output from masters and all its replicas.",
+"SIMULATE-FAILURE (crash-after-election|crash-after-promotion|help) -- Simulate a Sentinel crash.",
+"HELP -- Prints this help.",
+NULL
+ };
+ addReplyHelp(c, help);
+ } else if (!strcasecmp(c->argv[1]->ptr,"masters")) {
/* SENTINEL MASTERS */
if (c->argc != 2) goto numargserr;
addReplyDictOfRedisInstances(c,sentinel.masters);
@@ -3353,8 +3376,7 @@ void sentinelCommand(client *c) {
}
addReply(c,shared.ok);
} else {
- addReplyErrorFormat(c,"Unknown sentinel subcommand '%s'",
- (char*)c->argv[1]->ptr);
+ addReplySubcommandSyntaxError(c);
}
return;