From 57b8e00695d037971342cbcc43734a990bfaf081 Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Mon, 5 Oct 2020 06:37:20 -0400 Subject: [PATCH] support sentinel myid subcommand (#7858) --- src/sentinel.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sentinel.c b/src/sentinel.c index 36644a63c..a346a2547 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -3050,6 +3050,7 @@ void sentinelCommand(client *c) { "MASTER -- Show the state and info of the specified master.", "REPLICAS -- Show a list of replicas for this master and their state.", "SENTINELS -- Show a list of Sentinel instances for this master and their state.", +"MYID -- Show Current Sentinel Id", "IS-MASTER-DOWN-BY-ADDR -- Check if the master specified by ip:port is down from current Sentinel's point of view.", "GET-MASTER-ADDR-BY-NAME -- Return the ip and port number of the master with that name.", "RESET -- Reset masters for specific master name matching this pattern.", @@ -3097,6 +3098,9 @@ NULL if ((ri = sentinelGetMasterByNameOrReplyError(c,c->argv[2])) == NULL) return; addReplyDictOfRedisInstances(c,ri->sentinels); + } else if (!strcasecmp(c->argv[1]->ptr,"myid") && c->argc == 2) { + /* SENTINEL MYID */ + addReplyBulkCBuffer(c,sentinel.myid,CONFIG_RUN_ID_SIZE); } else if (!strcasecmp(c->argv[1]->ptr,"is-master-down-by-addr")) { /* SENTINEL IS-MASTER-DOWN-BY-ADDR *