sudo chmod 777 -R slave master
sudo chmod 0444 master/conf.d/master.cnf
sudo chmod 0444 slave/conf.d/slave.cnf
docker-compose up -d
--force-recreate
docker exec -i -t mysql-master /bin/bash
docker exec -i -t mysql-slave /bin/bash
ping mysql-master
ping mysql-slave
mysql -uroot -pmysql
select @@hostname;
use acquia;
show tables;
show master status\G
create table demo (id int);
show master status\G
insert into demo value(1);
show master status\G
select * from demo;
show master status\G
GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%' IDENTIFIED BY 'password';
CHANGE MASTER TO MASTER_HOST='mysql-master',MASTER_USER='slave_user', MASTER_PASSWORD='password';
show slave status\G
mysqldump -u root -pmysql -h mysql-master acquia > acquia-dbdump.sql
mysqldump -u root -pmysql -h mysql-master --master-data=1 acquia > acquia-dbdump.sql
http://mysql.wingtiplabs.com/documentation/sem40sk7/establish-semi-synchronous-replication.html
INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
mysql -uroot -pmysql acquia < acquia-dbdump.sql
show slave status\G
insert into demo value(2);
show master status\G
show slave status\G
start slave;
show master status\G
show slave status\G
On Master
cd /var/log/mysql/
mysqlbinlog mysql-bin.000004
On Slave
cd /var/log/mysql/
mysqlbinlog mysql-relay-bin.000003
(Content will be same in both files)
stop slave;
stop slave sql_thread;
insert on master ;
show master/slave status
SET GLOBAL sql_slave_skip_counter = N #Stop Sql , insert , start sql
insert into demo value(7),(8); insert into demo value(9),(10);
show binary logs;
PURGE BINARY LOGS TO 'mysql-bin.000003';
flush logs; ##PURGE BINARY LOGS TO 'mysql-bin.000005';
What will happen on start slave? Restore using Dump Restore