LoginSignup
3
5

More than 5 years have passed since last update.

Redis Sentinel 手動でのフェイルオーバー(スイッチオーバー)

Last updated at Posted at 2017-02-14

サーバーのOSのバージョンアップを行なった際、
手動でRedis Sentinelのフェイルオーバーを行なった際のメモ

master nodeが落ちたことを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 Nodeのフェイルオーバー先の重み付け

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より小さい値を設定して優先度を変える

3
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
5