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

支持后端mysql的健康检查及自动切换 #139

Open
chicliz opened this issue Dec 3, 2020 · 0 comments
Open

支持后端mysql的健康检查及自动切换 #139

chicliz opened this issue Dec 3, 2020 · 0 comments

Comments

@chicliz
Copy link
Contributor

chicliz commented Dec 3, 2020

健康检查配置

字段名称 字段类型 字段含义
open string 是否开启健康检查
mode string 健康检查模式, 目前支持两种模式 (poller/heartbeat)
interval string 健康检查间隔时间,单位: 秒
unhealthy_threshold string slave延迟时间, 超过该阈值则判定slave状态异常,单位: 秒
  • heartbeat模式
    创建一个用来健康检查的表, gaea定时访问master, 更新检查时间, 并从slave读取检查时间, 如果检查时间和当前时间的差值超出unhealthy_threshold, 判定slave短暂不可用, 请求将直接转移到其他slave或master.
    使用heartbeat模式需要先初始化库表.
CREATE DATABASE IF NOT EXISTS gaea_dba_check; 

CREATE TABLE IF NOT EXISTS gaea_dba_check.heartbeat ( 
  id INT UNSIGNED NOT NULL,
  check_timestamp  BIGINT UNSIGNED NOT NULL,
  unique key(id)
) engine=InnoDB
  • poller模式
    查询slave状态SHOW SLAVE STATUS, 获取该slice的mysql主从同步延迟时间Seconds_Behind_Master, 跟unhealthy_threshold比较, 超出阈值, 判定slave短暂不可用, 请求将直接转移到其他slave或master.
@chicliz chicliz linked a pull request Dec 8, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant