Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
e3bae846
Commit
e3bae846
authored
Jun 23, 2014
by
antirez
Browse files
Sentinel implementation of ROLE.
parent
54c46baf
Changes
1
Show whitespace changes
Inline
Side-by-side
src/sentinel.c
View file @
e3bae846
...
@@ -380,6 +380,7 @@ void sentinelCommand(redisClient *c);
...
@@ -380,6 +380,7 @@ void sentinelCommand(redisClient *c);
void sentinelInfoCommand(redisClient *c);
void sentinelInfoCommand(redisClient *c);
void sentinelSetCommand(redisClient *c);
void sentinelSetCommand(redisClient *c);
void sentinelPublishCommand(redisClient *c);
void sentinelPublishCommand(redisClient *c);
void sentinelRoleCommand(redisClient *c);
struct redisCommand sentinelcmds[] = {
struct redisCommand sentinelcmds[] = {
{"ping",pingCommand,1,"",0,NULL,0,0,0,0,0},
{"ping",pingCommand,1,"",0,NULL,0,0,0,0,0},
...
@@ -390,6 +391,7 @@ struct redisCommand sentinelcmds[] = {
...
@@ -390,6 +391,7 @@ struct redisCommand sentinelcmds[] = {
{"punsubscribe",punsubscribeCommand,-1,"",0,NULL,0,0,0,0,0},
{"punsubscribe",punsubscribeCommand,-1,"",0,NULL,0,0,0,0,0},
{"publish",sentinelPublishCommand,3,"",0,NULL,0,0,0,0,0},
{"publish",sentinelPublishCommand,3,"",0,NULL,0,0,0,0,0},
{"info",sentinelInfoCommand,-1,"",0,NULL,0,0,0,0,0},
{"info",sentinelInfoCommand,-1,"",0,NULL,0,0,0,0,0},
{"role",sentinelRoleCommand,1,"l",0,NULL,0,0,0,0,0},
{"shutdown",shutdownCommand,-1,"",0,NULL,0,0,0,0,0}
{"shutdown",shutdownCommand,-1,"",0,NULL,0,0,0,0,0}
};
};
...
@@ -2799,6 +2801,25 @@ void sentinelInfoCommand(redisClient *c) {
...
@@ -2799,6 +2801,25 @@ void sentinelInfoCommand(redisClient *c) {
addReply(c,shared.crlf);
addReply(c,shared.crlf);
}
}
/* Implements Sentinel verison of the ROLE command. The output is
* "sentinel" and the list of currently monitored master names. */
void sentinelRoleCommand(redisClient *c) {
dictIterator *di;
dictEntry *de;
addReplyMultiBulkLen(c,2);
addReplyBulkCBuffer(c,"sentinel",8);
addReplyMultiBulkLen(c,dictSize(sentinel.masters));
di = dictGetIterator(sentinel.masters);
while((de = dictNext(di)) != NULL) {
sentinelRedisInstance *ri = dictGetVal(de);
addReplyBulkCString(c,ri->name);
}
dictReleaseIterator(di);
}
/* SENTINEL SET <mastername> [<option> <value> ...] */
/* SENTINEL SET <mastername> [<option> <value> ...] */
void sentinelSetCommand(redisClient *c) {
void sentinelSetCommand(redisClient *c) {
sentinelRedisInstance *ri;
sentinelRedisInstance *ri;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment