// mysql 复制
show processlist\G
show variables like 'binlog_format'; // statement Row Mixed 3中复制技术
relay_log_purge // 是否开启删除reley_log
binlog_expire_logs_seconds // mysql8.0之后 多久之后删除
master.info & relay-log.info // 记录同步的位置
--master-info-repository --relay-log-info-repository
show binlog events in 'mysql-bin.000006' from 791\G
mysqlbinlog -vv mysql-bin.000006 --start-position=697
set binlog_format=Row;
[mysqld]
## 同一局域网内注意要唯一
server-id=7237
## 开启二进制日志功能,可以随便取(关键)
log-bin=mysql-bin
flush tables with read lock;
show master status;
unlock tables;
[mysqld]
server-id=7238
cat auto.cnf
// stop slave;
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'10.120.240.251' IDENTIFIED BY 'repl';
CHANGE MASTER TO MASTER_HOST='172.17.0.4',MASTER_PORT=3306,MASTER_USER='repl',MASTER_PASSWORD='repl',MASTER_LOG_FILE='mysql-bin.000001',MASTER_LOG_POS=5021;
start slave;
show slave status\G
show variables like 'sync_binlog';
show variables like 'slave_parallel%';
show variables like '%repository';
show variables like 'relay_log_recovery';
set global slave_parallel_type='LOGICAL_CLOCK';
set global slave_parallel_workers=8;
set global master_info_repository='TABLE';
set global relay_log_info_repository='TABLE';
set global slave_preserve_commit_order='ON';
slave_parallel_type=LOGICAL_CLOCK
slave_parallel_workers=8
master_info_repository=TABLE
relay_log_info_repository=TABLE
reley_log_recovery=ON
slave_preserve_commit_order=ON
// 安装半同步插件
show variables like 'rpl_semi_sync_master_wait_for_slave_count';
install plugin rpl_semi_sync_master SONAME 'semisync_master.so';
install plugin rpl_semi_sync_slave SONAME 'semisync_slave.so';
set global rpl_semi_sync_master_enabled=on;
set global rpl_semi_sync_master_timeout=1000;
set global rpl_semi_sync_slave_enabled=on;
set @@global.enforce_gtid_consistency=warn;
set @@global.enforce_gtid_consistency=on;
set @@global.gtid_mode=off_permissive;
set @@global.gtid_mode=on_permissive;
show status like 'ongoing_anonymous_transaction_count';
set @@global.gtid_mode=on;
stop slave;
change master to master_auto_position=1 ;
start slave;