Redis Sentinel 集群搭建常见注意事项

我的配置:

1个master,1个slave,3个sentinel

搭建的过程网上已经有很多了,这里列几个重点关注:

  1. 修改sentinel.conf的protected-mode与redis.conf的一致,要么都为yes,要么都为no。若未配置好可能会在主从切换时出现 failover-abort-no-good-slave 的故障
  2. 修改sentinel.conf的bind为本地ip。
  3. 每个redis.conf中的密码最好一致,因为同步的时候,redis会根据redis.conf中配置的masterauth去连接远程master。
  4. 若配置文件sentinel.conf中有myid,确保每个文件的myid值全局唯一(与其他sentinel.conf文件的不相同),否则可能导致明明起了多个sentinel,通过info sentinel命令却只能查到1个sentinel实例。
  5. 若以上配置没问题,但仍然出现各种诡异问题,如failover-abort-no-good-slave及info sentinel命令查到的sentinels数量不正确,就得检查防火墙配置了。可以通过redis-cli远程连接redis及sentinel端口,看看是否可以连接上,而不会出现“No route to host”等连接故障

猜你喜欢

转载自www.cnblogs.com/winstonet/p/9283805.html