我正在处理由一个 sentinel 监控的两个redis实例。
当主人关机并且有一个" + sdown"时,我运行notification-script
我在其 redis-client 上使用以下命令将奴隶提升为主人:
SLAVEOF NO ONE
。
工作正常。
我的问题是,奴隶成为主人并且应用程序再次继续工作大约需要10秒。
如何减少这个时间戳?
下面是 sentinel config ::::
sentinel monitor mymaster 127.0.0.1 6379 1
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 900000
sentinel can-failover mymaster yes
sentinel parallel-syncs mymaster 1
sentinel notification-script mymaster /etc/init.d/config/script.sh
答案 0 :(得分:1)
不是您问题的直接答案,而是对不同设置的描述,避免需要快速响应(在某些情况下)。
当我们在UML中建模用例时,我们从不将redis sentinel放在默认流中。对于未知错误发生的情况,哨兵是我们的守卫:异常流动。
如果我们事先知道客户端是否需要连接到不同的redis实例,我们只需指示客户端使用redis pub / sub(结合低分辨率轮询,因为pub / sub流量不能保证 - 交付) )。
亲切的问候,TW
答案 1 :(得分:1)
尝试减少sentinel down-after-milliseconds mymaster and failover-timeout mymaster