git clone https://github.com/danielcristho/docker-stuff.git && cd docker-stuff
cd single-node/mysql-master-slave
Create new environment file.
cp .env.example .env
Change the values as you want. Example:
MYSQL_DATABASE=docker_db
MYSQL_USER=docker_user
MYSQL_PASSWORD=docker_pass
MYSQL_ALLOW_EMPTY_PASSWORD=1
Run the .sh
file.
bash run.sh
or
./run.sh
Make sure the containers is up. Then accessing the master and slave.
docker exec -it mysql_master mysql -u docker_user -pdocker_pass
docker exec -it mysql_slave mysql -u docker_user -pdocker_pass
Try to create new table, create new database or others modification to make sure the replication is running.