redis通过sentinel failover报错“NOGOODSLAVE No suitable slave to promote”

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wojiuguowei/article/details/83786474

   问题描述

所有sentinel及master都down,5分钟后超过半数的sentinel才全部run起来,此时failover失败报错"NOGOODSLAVE No suitable slave to promote"


   root cause

跟down-after-milliseconds配置相关,代码中如果slave记录的master失联的时间超过max_master_down_time(down-after-milliseconds*10+sentinel认为master sdown的时间间隔),那么该slave就不会被promote成master。


   solution

该问题是redis-server的选主的机制问题,这样设计的原因可能是认为这样的slave数据跟master的一致性不好,升主之后数据丢失严重。产品或者业务可根据需要调大down-after-milliseconds。

    源码:sentinel.c:sentinelSelectSlave

猜你喜欢

转载自blog.csdn.net/wojiuguowei/article/details/83786474