MySQL DBA 复制基础及应用场景(八)
复制环境搭建
MySQL复制结构
MySQL复制原理
MySQL复制应用在什么场景
DTS=>row+GTID
=====================================
环境搭建
1.5.7.26
2.GTID+row
******************************************************
slave变成独立的节点
stop slave;
reset slave all;
reset slave -- RESET SLAVE
makes the slave forget its replication position in the master's binary log. This statement is meant to be used for a clean start: It clears the master info and relay log info repositories, deletes all the relay log files, and starts a new relay log file. It also resets to 0 the replication delay specified with the MASTER_DELAY
option to CHANGE MASTER TO
******************************************************
#d6ceb3
******************************************************
清除数据,让实例变成全新数据库
drop database xxx;
reset master;
show master status;
******************************************************
select @@server_uuid;
GTID:server_uuid+No
主库初始化一个实例
mysqld --defaults-file=xxx --initialize
#binlog
binlog_format=row
log_bin=/data/mysql....
#GTID
gtid_mode=on
enforce_gtid_consistency=on
server_id=ip+port
grant replication slave on *.* to 'repl'@'%' identified by 'repl';
reset master;
丛库初始化一个实例
mysqld --defaults-file=xxx --initialize
reset master;
change master to ...,master_auto_position=1;
retriveved_Gtid_Set:xxxxxxxxxx
Executed_Gtid_Set:
---------------------------------------
mysqldump --master-data=2 --single-transaction -A >db3306-`date +%Y%m%d`.sql
-- SET @@GLOBAL_GTID_PURGED='xxxxx'; --告诉io_thread从什么位置开始拉取日志
5.6 database
5.7binlog group commit
8.0 writeSet