pika icon indicating copy to clipboard operation
pika copied to clipboard

config配置支持:min-slaves-to-write/min-slaves-max-lag

Open yili1991 opened this issue 1 year ago • 6 comments

Which PikiwiDB functionalities are relevant/related to the feature request?

No response

Description

v3.5.5支持一下config,减少哨兵模式下主从切换导致的数据丢失情况。

  • min-slaves-to-write
  • min-slaves-max-lag

Proposed solution

  • min-slaves-to-write
  • min-slaves-max-lag

Alternatives considered

  • min-slaves-to-write
  • min-slaves-max-lag

yili1991 avatar Sep 25 '24 07:09 yili1991

主从切换的时候可能会数据丢失或者主从不一致

chejinge avatar Sep 27 '24 13:09 chejinge

Bot detected the issue body's language is not English, translate it automatically.


Data may be lost or master-slave inconsistency may occur when switching between master and slave.

Issues-translate-bot avatar Sep 27 '24 13:09 Issues-translate-bot

后续看一下参数作用

Mixficsol avatar Oct 11 '24 12:10 Mixficsol

Bot detected the issue body's language is not English, translate it automatically.


Let’s take a look at the parameters later

Issues-translate-bot avatar Oct 11 '24 12:10 Issues-translate-bot

这一块考虑了一下,暂时认为在控制面加这个逻辑比较合适,具体做法可以是: 当发现某个从节点lag超过阈值,向该节点发送config set slave-priority 0,这样redis-sentinel就不会再failover的时候将他列为候选人。相应的,当该滞后节点的进度追上时,再执行config set slave-priority 100,让其重新获得候选资格。

cheniujh avatar Jan 10 '25 06:01 cheniujh

Bot detected the issue body's language is not English, translate it automatically.


After thinking about this for a while, I temporarily think it is more appropriate to add this logic to the control surface. The specific method can be: When it is found that a slave node lag exceeds the threshold, send config set slave-priority 0 to the node, so that redis-sentinel will not list him as a candidate in failover. Correspondingly, when the progress of the lagging node catches up, execute config set slave-priority 100 to allow it to regain candidacy.

Issues-translate-bot avatar Jan 10 '25 06:01 Issues-translate-bot