Easily set up a mysql master / slave replication environment for test / development purposes. Supports single master and any number of slaves.
1.1K
Quick way:
Download a lightweight bash script to control the cluster:
git clone https://github.com/dougjohnson/mysql_replication_demo.git
Start the cluster (eg 1 master with 2 slaves):
cd mysql_replication_demo && start_cluster -n 2
Slow way:
Pull the master and slave images from docker hub:
docker pull doug/mysql-master
docker pull doug/mysql-slave
Start the master:
docker run -d -p 3306:3306 --name master doug/mysql-master
Start slave1 on port 3307:
docker run -d -p 3307:3306 --link master:master --name slave1 doug/mysql-slave --server-id=1
Start slave2 on port 3308:
docker run -d -p 3308:3306 --link master:master --name slave1 doug/mysql-slave --server-id=1
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;'
Content type
Image
Digest
sha256:5a6fa384b…
Size
114.3 MB
Last updated
about 11 years ago
docker pull doug/mysql-slave