项目作者: gritt

项目描述 :
master master & master slave replication in mysql
高级语言: Shell
项目地址: git://github.com/gritt/docker-mysql-replication.git
创建时间: 2018-03-19T21:32:37Z
项目社区:https://github.com/gritt/docker-mysql-replication

开源协议:GNU General Public License v3.0

下载


Docker MySQL Replication

A simple docker setup to add replication feature to MySQL.

You can choose between topologies by switching branches:

  1. topology/master-master
  2. topology/master-slave

Is expected that you have two physically different servers capable of running docker, each server will run a MySQL container, that’s why the 3306 port is exposed in the .env file, you can set either an external IP address (default port should be changed), or, an internal IP address if you have both servers in the same network.

Master to Slave

The most common topology, Master to Slave, perform ‘reads’ and ‘writes’ on the Master instance and can only perform ‘reads’ in the slave instance, when a entry is created / updated in the Master instance it reflects the changes to the Slave instance.

Master to Master

The Master to Master topology enables to perform ‘reads’ and ‘writes’ in both servers, created and updated entries are reflected in both ways, thus, extra care must be taken on the application side to avoid duplicated primary keys; if somehow both servers create the same key at the same time, when they sync with each other, it will fail (by configuration) and the servers will no longer be able to perform ‘writes’ until the issue is solved.

Open Source

Fell free to use, fork, open issues or pull request with improvements and bug fixes.