在主从架构的基础上继续增加三个哨兵
当前架构:1主2从3哨兵
启动顺序:redis主节点 -从节点1 -从节点2 - 哨兵依次启动(redis-sentinel sentinel-26380.cong)
测试情况如下:主节点死掉,三哨兵自动选举新的主节点,除非所有节点挂掉
哨兵模式配置文件:
port 26380 //当前哨兵端口26380 daemonize no pidfile "/var/run/redis-sentinel-26380.pid" logfile "" dir "/tmp" sentinel myid a233600a8bc3e5ff31650b88790995d18f2216a8 sentinel deny-scripts-reconfig yes sentinel monitor mymaster 127.0.0.1 6382 2 //监听的redis服务ip和端口及哨兵数量一半加1
sentinel down-after-milliseconds mymaster 30000 //主节点挂掉30秒后开始选举
sentinel config-epoch mymaster 2 sentinel leader-epoch mymaster 2
标签:mymaster,redis,模式,哨兵,26380,sentinel,节点 From: https://www.cnblogs.com/wscw/p/17933847.html