moha

module
v2.6.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2019 License: Apache-2.0

README

mysql-agent

中文文档

What is mysql-agent?

mysql-agent provides the high availability(HA) for cross-region MySQL clusters, by automating master failover and fast master switch.

  • High Availability

    Master failure detection and automating master failover enables master switch in a few seconds.

  • Brain Split Omission

    By configuring proper lease ttl, mysql-agent enables at most one master in the cluster at any time.

  • Cross AZ Topology

    Leveraging etcd as the service discovery, mysql-agent prevent its implementation from VIP, so that the cross-AZ MySQL cluster is able to be build via mysql-agent.

  • Manual Master/Slave Switch

    Besides the automated failover as described below, mysql-agent provides the ability to switch master manually.

Quick Start
Development Environment Setup
make init

make init does the following

  • check and install dep
  • check and install golint
  • check and install goimports
  • add git commit hook
  • prepare testing framework

now you can do development on your local machine

Local Machine Running Environment Setup
make env-up
Create Local Machine Running Agents, AKA Test Code on Local Machine
make docker-agent
make start-agents
Local Machine Running Environment Destroy
make clean-data
Roadmap

Roadmap

License

This project is under the Apache 2.0 license. See the LICENSE file for details.

Acknowledgments
  • Thanks rxi for the lightweight log framework
  • Thanks juju/errors for the error handling framework

Directories

Path Synopsis
cmd
pkg
log
switch.go Date 28/06/2018 Purpose moha manual sitchover 1 获取用户名和密码,读取配置文件 done 2 获取所有主从IP和端口 3 检查当前正在运行连接数,当系统连接数大于100,中止此次计划内切换 检查一下主从是否都OK,如果从库有问题,则提示具体有问题从库,并中止此次计划内切换 检查一下每个从库主从延迟,如果主从延迟大于10S,中止此次计划内切换 设置read_only; 如果成功:开始执行计划内切换;检查计划内切换是否成功 如果失败:重新将主库设置只读 关注目标:计划外切换失败,需要关注是否节点状态和之前一样;可通过日志查看到之前的节点信息 使用修改:不同的集群,目前切换的时候,需要修改filePath
switch.go Date 28/06/2018 Purpose moha manual sitchover 1 获取用户名和密码,读取配置文件 done 2 获取所有主从IP和端口 3 检查当前正在运行连接数,当系统连接数大于100,中止此次计划内切换 检查一下主从是否都OK,如果从库有问题,则提示具体有问题从库,并中止此次计划内切换 检查一下每个从库主从延迟,如果主从延迟大于10S,中止此次计划内切换 设置read_only; 如果成功:开始执行计划内切换;检查计划内切换是否成功 如果失败:重新将主库设置只读 关注目标:计划外切换失败,需要关注是否节点状态和之前一样;可通过日志查看到之前的节点信息 使用修改:不同的集群,目前切换的时候,需要修改filePath

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL