redis部署问题
在部署redis哨兵的时候,一开始一直都是失败:杀死master进程后,没有选出新的master
日志如下
9985:X 18 Feb 20:14:42.409 # +sdown master mymaster 192.168.200.248 6380
9985:X 18 Feb 20:14:42.410 # +odown master mymaster 192.168.200.248 6380 #quorum 1/1
9985:X 18 Feb 20:14:42.410 # +new-epoch 2048
9985:X 18 Feb 20:14:42.410 # +try-failover master mymaster 192.168.200.248 6380
9985:X 18 Feb 20:14:42.461 # +vote-for-leader mm55d2d712b1f3f312b637f9b546f00cdcedc787 2048
9985:X 18 Feb 20:14:42.461 # e4b0ae8ea9c5cb2952430b211219699ec95910c8 voted for e4b0ae8ea9c5cb2952430b211219699ec95910c8 2048
9985:X 18 Feb 20:14:53.230 # -failover-abort-not-elected master mymaster 192.168.200.248 6380
9985:X 18 Feb 20:14:53.313 # Next failover delay: I will not start a failover before Mon Feb 18 20:20:43 2019
百度以后,配置文件做了以下修改
redis进程的配置文件
加了protected-mode yes
redis的配置
bind 0.0.0.0
port 6387
protected-mode yes
logfile "6387.log"
dbfilename "dump-6387.rdb"
daemonize yes
sentinel进程的配置文件
加了protected-mode yes
删除了
Generated by CONFIG REWRITE
sentinel的配置
port 26387
daemonize yes
protected-mode yes
logfile "26387.log"
dir "/usr/local/redis-3.2.1/src/data"
sentinel myid ca0c76e94c5deeb110bc93665bc028464905fc6c
sentinel monitor mymaster 192.168.200.248 6387 1
一下是百度到的一些问题以及解决方式
-failover-abort-not-elected master mymaster问题
redis配置sentinel,master shutdown后主从切换失败,提示错误
-failover-abort-not-elected master mymaster x.x.x.x 6379
原因是sentinel.conf缺少配置,若redis.conf中添加
protected-mode yes
bind 0.0.0.0
则sentinel.conf中添加该属性。
一下是几篇redis部署的博文
https://blog.csdn.net/yingxiake/article/details/51671335
https://www.phpsong.com/3770.html