config配置支持:min-slaves-to-write/min-slaves-max-lag
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
主从切换的时候可能会数据丢失或者主从不一致
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.
后续看一下参数作用
Bot detected the issue body's language is not English, translate it automatically.
Let’s take a look at the parameters later
这一块考虑了一下,暂时认为在控制面加这个逻辑比较合适,具体做法可以是: 当发现某个从节点lag超过阈值,向该节点发送config set slave-priority 0,这样redis-sentinel就不会再failover的时候将他列为候选人。相应的,当该滞后节点的进度追上时,再执行config set slave-priority 100,让其重新获得候选资格。
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.