Docker master slave MySQL replication

Docker master slave mysql replication can be a bit intimidating, but the basics are actually quite easy, just a bit of a laborious work. As of this example I will use docker swarm. for that I assume you have docker already installed fresh on the machine. My example uses CentOS 7.6, but should be similar on other systems like ubuntu. Enjoy the post!

Get the mysql image:

docker pull percona:5.7

Create a few dirs to hold the structure:

  1. Two separate folders for master and slave.
  2. The cnf directory has the configuration files for mysql
  3. The data directory has the volume of mysql structural data.
  4. The folders called mysql, performance schema and sys should NOT be created. those are done by MySQL server on start.

Continue reading