moha

MoHA(Mobike High Availability): A MySQL/Postgres high availability supervisor

Github星跟蹤圖

moha_logo

Build Status
Go Report Card
License

What is Mobike High Availability(MoHA)? 中文

MoHA 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 Prevention

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

  • Cross AZ Topology

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

  • Multiple Standby

    MoHA supports MySQL cluster with multiple standby servers,
    and ensures that the server with latest log will be promoted during failover.

  • Single Point Primary Mode

    When there is only one MySQL surviving in the cluster,
    it is able to provide R/W services even if the communication to etcd is unstable or broken,
    which is called Single Point Primary Mode. MoHA enters and exits this mode automatically.

  • Manual Master/Slave Switch

    Besides the automated failover, which is described below, MoHA provides the ability to switch master manually.

MoHA is Supporting Mobike Databases in Production

Quick Start

Run in Production

Docker image is already available on Dockerhub

Latest image tag is v2.4.0, run docker pull moiot/moha:v2.4.0 to pull the image

config and start/stop scripts refers to operation doc

Runtime Dependencies

  • Docker recommended with the latest version
  • etcd with version no earlier than 3.3.2

One AZ Example
1az

Three AZs Example
3az

Download Source Code

cd $GOPATH
mkdir -p src/github.com/moiot
cd src/github.com/moiot
git clone <remote_repo> moha
cd moha

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
  • Thanks yubai for his Lease analysis

主要指標

概覽
名稱與所有者moiot/moha
主編程語言Go
編程語言Makefile (語言數: 6)
平台
許可證Apache License 2.0
所有者活动
創建於2018-11-21 02:43:51
推送於2019-10-17 11:54:25
最后一次提交2019-03-01 16:29:18
發布數4
最新版本名稱v2.6.1 (發布於 2019-01-15 17:24:17)
第一版名稱v2.5.0 (發布於 )
用户参与
星數134
關注者數14
派生數52
提交數23
已啟用問題?
問題數12
打開的問題數9
拉請求數14
打開的拉請求數0
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?