web-dev-qa-db-ja.com

Redis:フェイルオーバーの失敗-センチネルは新しいマスターノードを選択できません

単純なマスタースレーブセットアップで、4つの異なる仮想マシンに4つのserverおよびsentinelインスタンスをセットアップしました。キーレプリケーションは正常に機能し、すべてのredisノードが相互に認識します(known-sentinelおよびknown-slaveオプションを参照しています)。

障害をシミュレートしようとすると、問題が発生します。歩哨は、新しいマスターを選出できないと言い続けています(failover-abort-not-elected):

12481:X 22 Jun 17:20:05.761 # <__IP1__>:51002 voted for a3ba8d8cd0c15c8b186b44ba529b83d3a8424a42 27
12481:X 22 Jun 17:20:14.140 # -sdown master mymaster <__IP2__> 6379
12481:X 22 Jun 17:20:14.140 # -odown master mymaster <__IP2__> 6379
12481:X 22 Jun 17:20:16.567 # -failover-abort-not-elected master mymaster <__IP2__> 6379

redis-cliでセンチネルの状態を照会すると、実際の数よりも使用可能なセンチネルインスタンスの数の値が大きくなり続けるというもう1つの奇妙なことです(もちろん、4を超えることはできません(右?))。

$ redis-cli -p 51001
> info
[...]
master0:name=mymaster,status=ok,address=91.120.59.231:6379,slaves=3,sentinels=8

また、センチネルを起動すると、次の-dup-sentinelメッセージが表示され続けます。

14563:X 23 Jun 11:10:18.015 * -dup-sentinel master mymaster <__IP_MASTER__> 6379 #duplicate of <__IP_SLAVE2__>:51003 or 65db9ddba84433f71aa77c9263807e6abd939d2c

センチネルの設定の1つは次のとおりです。

daemonize yes
pidfile "/var/run/redis/redis-sentinel.pid"
logfile "/var/log/redis/redis-sentinel.log"

# bind 192.168.1.100 10.0.0.1
# port 26379

port 51004

dir "/var/lib/redis"

sentinel monitor mymaster <__IP_MASTER__> 6379 2
sentinel failover-timeout mymaster 60000
sentinel auth-pass mymaster <___________PASSW___________>
sentinel config-Epoch mymaster 0
sentinel leader-Epoch mymaster 55428

# Generated by CONFIG REWRITE
maxclients 4064
sentinel known-slave mymaster <__IP_SLAVE1__> 6379
sentinel known-slave mymaster <__IP_SLAVE2__> 6379
sentinel known-slave mymaster <__IP_SLAVE3__> 6379
sentinel known-sentinel mymaster <__IP_SLAVE1__> 51002 bfea8e89873353d5c1e9ed498b17f298bd6b6082
sentinel known-sentinel mymaster <__IP_MASTER__> 26379 c04fc07022a251e56e81e21dbe018bd471745038
sentinel known-sentinel mymaster <__IP_SLAVE2__> 51003 b5a56eb69abb5893203ecf7b1a7d28ae4aa06ab5
sentinel known-sentinel mymaster <__IP_MASTER__> 51001 be1ff6c9e4a62abea132c24447fd3cb38d221496
sentinel known-sentinel mymaster <__IP_SLAVE1__> 26379 f5a7fd0ee199afc02ffafc0e822363acf5595b1c
sentinel known-sentinel mymaster <__IP_SLAVE2__> 26379 6328962293b7838fa88b9f176b9bc4cc08f2e26d
sentinel current-Epoch 26

ログファイルは実際には有益ではありません...もう少し冗長にする方法はありますか?私がここで何を見逃しているのか分かりますか?

前もって感謝します!

バンピングポスト:

ファイアウォールの設定を確認しました。問題はなかったはずです。ファイアウォールを完全に遮断したときに、同じエラーが発生していました。

1
Gergely Lukacsy

古いセンチネルは構成から削除されません。ドキュメントを見てください redis sentinel

実行:SENTINEL RESET mymasterそしてしばらくの間、新しいマスターが選出されるべきです。

1
bu21

sentinel default config から取得:

# *** IMPORTANT ***
#
# By default Sentinel will not be reachable from interfaces different than
# localhost, either use the 'bind' directive to bind to a list of network
# interfaces, or disable protected mode with "protected-mode no" by
# adding it to this configuration file.
#
# Before doing that MAKE SURE the instance is protected from the outside
# world via firewalling or other means.
#
# For example you may use one of the following:
#
# bind 127.0.0.1 192.168.1.1

したがって、server's IPをバインドしてみてください。

グラック!

1
Justin