redis之哨兵配置-2 redis之主从配置-1

  一、redis为啥需要哨兵?如果我们只是配置了redis的主从关系,那么当master宕机的时候,其他slave的服务器不会做任何变化。那么要达到主从切换的效果就要,手动干预。为了 更加方便的控制redis的主从关系,redis提供了一套监控机制,也就是redis的哨兵模式(sentinel)

  二、redis的下载地址:http://download.redis.io/releases/

  三、redis的安装:https://www.cnblogs.com/ll409546297/p/6993778.html

  四、redis的主从配置:https://www.cnblogs.com/ll409546297/p/13541697.html

  五、哨兵模式是独立的进程运行,配置文件为sentinel.conf

  

  三、哨兵模式的配置(这里我配置了2个哨兵)

bind 0.0.0.0 # 修改bind或者注释
protected-mode no # 管理保护
daemonize yes # 守护进程
port 26371/26372 # 端口
sentinel monitor mymaster 192.168.5.23 6370 1 # 监控redis配置 sentinel parallel-syncs <master-name> <numreplicas> 最后一位为投票数,以确认redis服务失效

  四、启动哨兵

./src/redis-sentinel ./sentinel-conf/sentinel1.conf
./src/redis-sentinel ./sentinel-conf/sentinel2.conf

  

  五、测试效果

  查看redis之主从配置-1的第七点。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章