Public Repository

Last pushed: 2 years ago
Short Description
Easily set up a mysql master / slave replication environment for test / development purposes. Supports single master and any number of slaves.
Full Description

Easy MySQL Replicating Cluster for Dev / Test Purposes

Quick way:

  1. Download a lightweight bash script to control the cluster:

    git clone https://github.com/dougjohnson/mysql_replication_demo.git

  2. Start the cluster (eg 1 master with 2 slaves):

    cd mysql_replication_demo && start_cluster -n 2

Slow way:

  1. Pull the master and slave images from docker hub:

    docker pull doug/mysql-master

    docker pull doug/mysql-slave

  2. Start the master:

    docker run -d -p 3306:3306 --name master doug/mysql-master

  3. Start slave1 on port 3307:

    docker run -d -p 3307:3306 --link master:master --name slave1 doug/mysql-slave --server-id=1

  4. Start slave2 on port 3308:

    docker run -d -p 3308:3306 --link master:master --name slave1 doug/mysql-slave --server-id=1

  5. Connect via 127.0.0.1:

    mysql -uroot -proot -h 127.0.0.1 -P 3306 -e 'create database cluster_test;'

    mysql -uroot -proot -h 127.0.0.1 -P 3307 -e 'show databases;'

Docker Pull Command
Owner
doug

Comments (0)