Sentinel: added SENTINEL MASTER <name> command.

With SENTINEL MASTERS it was already possible to list all the configured
masters, but not a specific one.
This commit is contained in:
antirez 2014-01-10 14:41:44 +01:00
parent 2bb9cd464e
commit c42e4bd0b6

View File

@ -2378,8 +2378,14 @@ void sentinelCommand(redisClient *c) {
if (!strcasecmp(c->argv[1]->ptr,"masters")) {
/* SENTINEL MASTERS */
if (c->argc != 2) goto numargserr;
addReplyDictOfRedisInstances(c,sentinel.masters);
} else if (!strcasecmp(c->argv[1]->ptr,"master")) {
/* SENTINEL MASTER <name> */
sentinelRedisInstance *ri;
if ((ri = sentinelGetMasterByNameOrReplyError(c,c->argv[2]))
== NULL) return;
addReplySentinelRedisInstance(c,ri);
} else if (!strcasecmp(c->argv[1]->ptr,"slaves")) {
/* SENTINEL SLAVES <master-name> */
sentinelRedisInstance *ri;