mirror of
https://github.com/fluencelabs/redis
synced 2025-06-22 13:31:32 +00:00
Sentinel: Redis-side support for slave priority.
A Redis slave can now be configured with a priority, that is an integer number that is shown in INFO output and can be get and set using the redis.conf file or the CONFIG GET/SET command. This field is used by Sentinel during slave election. A slave with lower priority is preferred. A slave with priority zero is never elected (and is considered to be impossible to elect even if it is the only slave available). A next commit will add support in the Sentinel side as well.
This commit is contained in:
@ -1137,6 +1137,7 @@ void initServerConfig() {
|
||||
server.repl_serve_stale_data = 1;
|
||||
server.repl_slave_ro = 1;
|
||||
server.repl_down_since = time(NULL);
|
||||
server.slave_priority = REDIS_DEFAULT_SLAVE_PRIORITY;
|
||||
|
||||
/* Client output buffer limits */
|
||||
server.client_obuf_limits[REDIS_CLIENT_LIMIT_CLASS_NORMAL].hard_limit_bytes = 0;
|
||||
@ -2045,6 +2046,8 @@ sds genRedisInfoString(char *section) {
|
||||
"master_link_down_since_seconds:%ld\r\n",
|
||||
(long)server.unixtime-server.repl_down_since);
|
||||
}
|
||||
info = sdscatprintf(info,
|
||||
"slave_priority:%d\r\n", server.slave_priority);
|
||||
}
|
||||
info = sdscatprintf(info,
|
||||
"connected_slaves:%lu\r\n",
|
||||
|
Reference in New Issue
Block a user