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的第七點。

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