From 52cf0975c780a02b720233c306b9c7e08d169b47 Mon Sep 17 00:00:00 2001 From: antirez Date: Fri, 10 Jan 2014 14:41:44 +0100 Subject: [PATCH] Sentinel: added SENTINEL MASTER command. With SENTINEL MASTERS it was already possible to list all the configured masters, but not a specific one. --- src/sentinel.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sentinel.c b/src/sentinel.c index 584ebf09..13d949e5 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -2380,8 +2380,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 */ + sentinelRedisInstance *ri; + + if ((ri = sentinelGetMasterByNameOrReplyError(c,c->argv[2])) + == NULL) return; + addReplySentinelRedisInstance(c,ri); } else if (!strcasecmp(c->argv[1]->ptr,"slaves")) { /* SENTINEL SLAVES */ sentinelRedisInstance *ri;