Redis Sentinel 手动执行故障转移(切换)

当对服务器的操作系统进行升级时,
手动执行Redis Sentinel的故障转移时的备忘。

为了缩短Sentinel检测到主节点故障的时间,建议手动执行故障转移…

以下是公式文档中关于手动故障切换的部分描述。

SENTINEL failover <master name> Force a failover as if the master was not reachable, and without asking for agreement
to other Sentinels (however a new version of the configuration will be published so that the other Sentinels will update their configurations).

命令

我们是用docker来运营的,就像这样.

docker exec -it docker_redis-sentinel1_1 bash
redis-cli -p 26379
SENTINEL failover mymaster

为Redis节点的故障转移进行加权。

请将以下内容用中文进行改写,只需要一种选项:
http://download.redis.io/redis-stable/redis.conf

将这个链接改为中文:
http://download.redis.io/redis-stable/redis.conf

# The slave priority is an integer number published by Redis in the INFO output.
# It is used by Redis Sentinel in order to select a slave to promote into a
# master if the master is no longer working correctly.
#
# A slave with a low priority number is considered better for promotion, so
# for instance if there are three slaves with priority 10, 100, 25 Sentinel will
# pick the one with priority 10, that is the lowest.
#
# However a special priority of 0 marks the slave as not able to perform the
# role of master, so a slave with priority of 0 will never be selected by
# Redis Sentinel for promotion.
#
# By default the priority is 100.
slave-priority 100

将 slave-priority 设定为小于100的值以改变优先级

广告
将在 10 秒后关闭
bannerAds