Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yili1991 opened this issue Sep 25, 2024 · 6 comments
Open

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

yili1991 opened this issue Sep 25, 2024 · 6 comments
Labels
✏️ Feature New feature or request

Comments

@yili1991
Copy link

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 yili1991 added the ✏️ Feature New feature or request label Sep 25, 2024
@chejinge
Copy link
Collaborator

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

@Issues-translate-bot
Copy link

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.

@Mixficsol
Copy link
Collaborator

后续看一下参数作用

@Issues-translate-bot
Copy link

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


Let’s take a look at the parameters later

@cheniujh
Copy link
Collaborator

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

@Issues-translate-bot
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✏️ Feature New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants