ioggstream/mysql

By ioggstream

Updated over 9 years ago

MySQL Image with Master-Slave replication

Image
6

706

A MySQL 5.6 image supporting the following environment variables:

  • MYSQL_ROOT_PASSWORD
  • MYSQL_REPLICA_USER: create the given user on the intended master host
  • MYSQL_REPLICA_PASS
  • MYSQL_MASTER_SERVER: change master on this location on the intended slave
  • MYSQL_MASTER_PORT: optional, by default 3306
  • MYSQL_MASTER_WAIT_TIME: seconds to wait for the master to come up

You can use this fig.yml to setup a master-slave:

# run with: #fig up
master:
  image: ioggstream/mysql:5.6-replica
  ports:
    - 3301:3306
  environment:
    - MYSQL_ROOT_PASSWORD=root
    - MYSQL_REPLICA_USER=repl
    - MYSQL_REPLICA_PASS=replpass
  command: mysqld --log-bin=mysql-bin  --server-id=1  


slave:
  image: ioggstream/mysql:5.6-replica
  ports:
    - 3302:3306
  environment:
    - MYSQL_ROOT_PASSWORD=root
    - MYSQL_REPLICA_USER=repl
    - MYSQL_REPLICA_PASS=replpass
    - MYSQL_MASTER_SERVER=master
  links:
    - master
  command: mysqld --log-bin=mysql-bin  --server-id=2 

Docker Pull Command

docker pull ioggstream/mysql