mariadb container master-slave replication with health Monitoring
Running the deploy_config.sh
after clonning the Repo to you Server.
sudo apt update
sudo apt-get remove docker docker-engine docker.io
sudo apt install docker.io
sudo systemctl start docker
sudo systemctl enable docker
sudo groupadd docker
sudo gpasswd -a "${USER}" docker
usermod -aG docker "${USER}"
mkdir -p /opt/mariadb/master-data
sudo chown -R 1001:1001 /opt/mariadb/master-data/
Running containers in dettached mode but when you remove the "-d" it could help with debugging the running configs in the container!
docker run -d or docker-compose up -d
docker exec -it $container_id bash
$ mysql -u my_user -p
#my_password
show databases;
use my_databse;
exit;
login with root
$ mysql -u root -p
#master_root_password
then
show master status;
docker exec -i adprcc3ms_mariadb-master_1 mysql -uroot -pmaster_root_password my_database < mariadb-master-dump.sql
docker exec -i adprcc3ms_mariadb-master_1 mysqldump -uroot -pmaster_root_password my_database > mariadb-master-dump.sql
docker stop $container_id
rsync -a /opt/mariadb/master-data /opt/mariadb/master-data.bkp.$(date +%Y%m%d-%H.%M.%S)
docker-compose up --detach --scale mariadb-master=1 --scale mariadb-slave=3
docker stop $container_id
docker rm $container_id
docker prune -a
sudo grep CRON /var/log/syslog