shenkonghui / issue

问题记录
0 stars 0 forks source link

redis哨兵 命令查看和配置文件信息不一致 #104

Closed shenkonghui closed 3 years ago

shenkonghui commented 3 years ago

这里看到的master是10.168.247.8

skhdebMac:~ shenkonghui$ redis-cli -h 10.168.247.33 -a dangerous -p 26379 info Sentinel
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
# Sentinel
sentinel_masters:1
sentinel_tilt:0
sentinel_running_scripts:0
sentinel_scripts_queue_length:0
sentinel_simulate_failure_flags:0
master0:name=mymaster,status=sdown,address=10.168.247.8:6379,slaves=0,sentinels=1

而直接查看sentinel.conf文件看到的master是10.168.145.86,这才是实际的master

root@redis-sentinel-7877857567-cx78r:/redis# cat sentinel.conf
sentinel myid f61c067c8c3a8e7afed4189718ffb94f7839018c
sentinel deny-scripts-reconfig yes
sentinel monitor mymaster 10.168.145.86 6379 2

# Generated by CONFIG REWRITE
port 26379
dir "/data"

sentinel auth-pass mymaster Hc@Cloud01
sentinel config-epoch mymaster 2
sentinel leader-epoch mymaster 2
sentinel known-replica mymaster 10.168.247.8 6379
sentinel known-replica mymaster 10.168.152.169 6379

sentinel known-replica mymaster 10.168.145.117 6379
sentinel known-replica mymaster 10.168.247.7 6379
sentinel known-replica mymaster 10.168.152.174 6379
sentinel known-sentinel mymaster 10.168.145.108 26379 8783d535d5269eb4b660edeeef5bc0fc40f72248
sentinel known-sentinel mymaster 10.168.145.72 26379 ba20f10bc8532e41f5f8026b0a91ce21cbe99871
sentinel current-epoch 2

哨兵日志

:X 04 Aug 2021 06:34:28.533 * +sentinel sentinel 8783d535d5269eb4b660edeeef5bc0fc40f72248 10.168.145.108 26379 @ mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:34:29.978 * +slave slave 10.168.152.169:6379 10.168.152.169 6379 @ mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:34:29.979 * +slave slave 10.168.145.86:6379 10.168.145.86 6379 @ mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:34:29.982 * +slave slave 10.168.145.117:6379 10.168.145.117 6379 @ mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:34:29.983 * +slave slave 10.168.152.174:6379 10.168.152.174 6379 @ mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:34:29.983 * +slave slave 10.168.247.7:6379 10.168.247.7 6379 @ mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:35:38.285 # +sdown master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:35:38.351 # +odown master mymaster 10.168.247.8 6379 #quorum 2/2
1:X 04 Aug 2021 06:35:38.351 # +new-epoch 2
1:X 04 Aug 2021 06:35:38.351 # +try-failover master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:35:38.361 # +vote-for-leader f61c067c8c3a8e7afed4189718ffb94f7839018c 2
1:X 04 Aug 2021 06:35:38.365 # 8783d535d5269eb4b660edeeef5bc0fc40f72248 voted for f61c067c8c3a8e7afed4189718ffb94f7839018c 2
1:X 04 Aug 2021 06:35:38.366 # ba20f10bc8532e41f5f8026b0a91ce21cbe99871 voted for f61c067c8c3a8e7afed4189718ffb94f7839018c 2
1:X 04 Aug 2021 06:35:38.413 # +elected-leader master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:35:38.413 # +failover-state-select-slave master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:35:38.503 # +selected-slave slave 10.168.145.86:6379 10.168.145.86 6379 @ mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:35:38.503 * +failover-state-send-slaveof-noone slave 10.168.145.86:6379 10.168.145.86 6379 @ mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:35:38.556 * +failover-state-wait-promotion slave 10.168.145.86:6379 10.168.145.86 6379 @ mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:35:39.185 # +promoted-slave slave 10.168.145.86:6379 10.168.145.86 6379 @ mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:35:39.185 # +failover-state-reconf-slaves master mymaster 10.168.247.8 6379
....
...

1:X 04 Aug 2021 06:44:50.870 # +reset-master master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:44:53.326 # +reset-master master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:44:53.330 # +reset-master master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:45:09.171 # +reset-master master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:45:09.212 # +reset-master master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:45:11.564 # +reset-master master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:45:11.613 # +reset-master master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:45:27.454 # +reset-master master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:45:27.457 # +reset-master master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:45:29.770 # +reset-master master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:45:29.814 # +reset-master master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:45:45.919 # +reset-master master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:45:45.922 # +reset-master master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:45:48.117 # +reset-master master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:45:48.120 # +reset-master master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:46:18.157 # +sdown master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:47:01.717 # +reset-master master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:47:03.132 # +reset-master master mymaster 10.168.247.8 6379
1:X 04 Aug 2021 06:47:33.169 # +sdown master mymaster 10.168.247.8 6379
shenkonghui commented 3 years ago

代码中大量执行了reset了