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:
- Two separate folders for master and slave.
- The cnf directory has the configuration files for mysql
- The data directory has the volume of mysql structural data.
- The folders called mysql, performance schema and sys should NOT be created. those are done by MySQL server on start.