From f822516e43b8fadcfbb97cee281eee19fdcfe2ad Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 13 Jan 2014 11:50:38 +0100 Subject: [PATCH] SENTINEL SET implemented. The new command allows to change master-specific configurations at runtime. All the settable parameters can be retrivied via the SENTINEL MASTER command, so there is no equivalent "GET" command. --- src/sentinel.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/src/sentinel.c b/src/sentinel.c index 3df4d3a08..f2fe1540c 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -368,6 +368,7 @@ dictType leaderVotesDictType = { void sentinelCommand(redisClient *c); void sentinelInfoCommand(redisClient *c); +void sentinelSetCommand(redisClient *c); struct redisCommand sentinelcmds[] = { {"ping",pingCommand,1,"",0,NULL,0,0,0,0,0}, @@ -2530,6 +2531,9 @@ void sentinelCommand(redisClient *c) { dictDelete(sentinel.masters,c->argv[2]->ptr); sentinelFlushConfig(); addReply(c,shared.ok); + } else if (!strcasecmp(c->argv[1]->ptr,"set")) { + if (c->argc < 3 || c->argc % 2 == 0) goto numargserr; + sentinelSetCommand(c); } else { addReplyErrorFormat(c,"Unknown sentinel subcommand '%s'", (char*)c->argv[1]->ptr); @@ -2541,6 +2545,7 @@ numargserr: (char*)c->argv[1]->ptr); } +/* SENTINEL INFO [section] */ void sentinelInfoCommand(redisClient *c) { char *section = c->argc == 2 ? c->argv[1]->ptr : "default"; sds info = sdsempty(); @@ -2600,6 +2605,79 @@ void sentinelInfoCommand(redisClient *c) { addReply(c,shared.crlf); } +/* SENTINEL SET [