Redis基础知识(学习笔记19--Redis Sentinel)

打印 上一主题 下一主题

主题 1800|帖子 1800|积分 5400

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
 优化配置参数

1.down-after-milliseconds
  1. # sentinel down-after-milliseconds <master-name> <milliseconds><br>#<br># Number of milliseconds the master (or any attached【所依附的】 slave or sentinel) should<br># be unreachable (as in, not acceptable reply to PING, continuously, for the<br># specified period) in order to consider it in S_DOWN state (Subjectively<br># Down).<br># 这段的意思是sentinel在和master【注意:不仅仅是master,还有slave、sentinel】失联多少毫秒后,可以做出主节点S_DOWN的判断。<br># 此参数的作用范围不仅仅是 sentinel到master的连接;还有sentinel到slave的连接;sentinel到sentinel的连接。<br># Default is 30 seconds.<br><br><em id="__mceDel" ><em id="__mceDel"><em id="__mceDel"><em id="__mceDel"><em id="__mceDel"><em id="__mceDel"><em id="__mceDel">sentinel down-after-milliseconds mymaster 30000</em></em></em></em></em></em></em>
复制代码
换句话说
down-after-milliseconds is the time in milliseconds an instance should not be reachable (either does not reply to our PINGs or it is replying with an error) for a Sentinel starting to think it is down.
2. parallel-syncs
  1. # sentinel parallel-syncs <master-name> <numslaves>
  2. #
  3. # How many slaves we can reconfigure to point to the new slave simultaneously【同时】
  4. # during the failover. Use a low number if you use the slaves to serve query
  5. # to avoid that all the slaves will be unreachable at about the same
  6. # time while performing the synchronization with the master.<br>##如果想在failover期间,slave同步新master的这个过程中,仍然想有部分slave 可以提供查询服务,那么可以将这个<br>##值设置小一点。【需要注意的是,这样带来的坏处就是:提供的查询服务,不保证数据的一致性,和主节点是有数据差异的;<br>##此外,faiover的master 和 所有slave的数据同步过程被拉长了】
  7. sentinel parallel-syncs mymaster 1
复制代码
parallel-syncs sets the number of replicas that can be reconfigured to use the new master after a failover at the same time. The lower the number, the more time it will take for the failover process to complete, however if the replicas are configured to serve old data, you may not want all the replicas to re-synchronize with the master at the same time. While the replication process is mostly non blocking for a replica, there is a moment when it stops to load the bulk data from the master. You may want to make sure only one replica at a time is not reachable by setting this option to the value of 1. 
 3.failover-timeout
  1. # sentinel failover-timeout <master-name> <milliseconds>
  2. #
  3. # Specifies the failover timeout in milliseconds. It is used in many ways: ##【注意:这个时间有多个用途】
  4. #
  5. # - The time needed to re-start a failover after a previous failover was
  6. # already tried against the same master by a given Sentinel, is two
  7. # times the failover timeout. ---定语比较多,比较复杂,<br># 抽出核心主谓宾:The time is two times the failover timeout.
  8. #
  9. # - The time needed for a slave replicating to a wrong master according
  10. # to a Sentinel current configuration, to be forced to replicate
  11. # with the right master, is exactly【确切地;恰好】 the failover timeout (counting since
  12. # the moment a Sentinel detected the misconfiguration).##【从sentinel发现配置信息不准确时开始计时】<br># 抽出核心主谓宾:The time is exactly the failover timeout.
  13. #
  14. # - The time needed to cancel a failover that is already in progress but
  15. # did not produced any configuration change (SLAVEOF NO ONE yet not
  16. # acknowledged by the promoted slave).<br># 抽出核心主谓宾:The time needed to cancel a failover.
  17. #
  18. # - The maximum time a failover in progress waits for all the slaves to be
  19. # reconfigured as slaves of the new master. However even after this time
  20. # the slaves will be reconfigured by the Sentinels anyway, but not with
  21. # the exact parallel-syncs progression as specified.
  22. # 【however后面的意思是说:然而,不管怎么样,即是超过了这个定义的最大阈值,sentinel还是可以修改配置的;<br>#  但是,不是严格按照前面定义的parallel-syncs的方式,例如,不再是前面默认的一个一个slave节点处理了。】
  23. # Default is 3 minutes.
  24. sentinel failover-timeout mymaster 180000
复制代码
 Moreover Sentinels have a rule: if a Sentinel voted another Sentinel for the failover of a given master, it will wait some time to try to failover the same master again. This delay is the 2 * failover-timeout you can configure in sentinel.conf. This means that Sentinels will not try to failover the same master at the same time, the first to ask to be authorized will try, if it fails another will try after some time, and so forth.
 指定故障转移的超时时间,默认时间为3分钟。该超时时间的用途有很多:

  • 由于第一次故障转移失败,在同一个master上进行第二次故障转移实验的时间为gai值的两倍。
  • 新master提升完毕,slave从老master强制移到新master进行数据同步的时间阈值。
  • 取消正在进行的故障转移所需的时间阈值。
  • 新master提升完毕,所有的replicas的配置文件更新为新master的时间阈值。
 
《High availability with Redis Sentinel》
https://redis.io/docs/latest/operate/oss_and_stack/management/sentinel/

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

惊雷无声

论坛元老
这个人很懒什么都没写!
快速回复 返回顶部 返回列表