标签:库存 service 语句 osi ble div ast pes 冲突
MySQL5.7开始新增多源复制功能,即允许一个salve同时复制多个主库的事务,slave会创建通往每个主库的管道。多源复制在应用来自多个源的事务的时候不会对有冲突的事务进行检测。
配置实现
主库支持基于GTID和binlog position的配置;从库存储master信息的仓库需要为table:
#在配置文件中加入
master-info-repository=TABLE relay-log-info-repository=TABLE
#在线更改
STOP SLAVE;
SET GLOBAL master_info_repository = ‘TABLE‘;
SET GLOBAL relay_log_info_repository = ‘TABLE‘;
在从上添加对基于GTID的主库的通道
CHANGE MASTER TO MASTER_HOST=‘master1‘, MASTER_USER=‘rpl‘, MASTER_PORT=3451, MASTER_PASSWORD=‘‘, MASTER_AUTO_POSITION = 1 FOR CHANNEL ‘master-1‘;
开始复制
#默认开启所有的复制通道 START SLAVE thread_types; #指定复制通道开启 START SLAVE thread_types FOR CHANNEL channel;
停止复制
#停止所有的复制通道 STOP SLAVE thread_types; #指定复制通道停止 STOP SLAVE thread_types FOR CHANNEL channel;
重置多源复制的从库
通过reset slave语句可以重置多源复制的从库,默认是重置所有的复制通道,也可以指定通道进行重置
RESET SLAVE; RESET SLAVE FOR CHANNEL channel;
多源复制监控
通过联合查询performance schema中的复制表进行监控复制线程的状态
select conn.CHANNEL_NAME,conn.SERVICE_STATE io_status,applier.SERVICE_STATE sql_status from performance_schema.replication_applier_status applier join performance_schema.replication_connection_status conn on applier.CHANNEL_NAME=conn.CHANNEL_NAME; +--------------+-----------+------------+ | CHANNEL_NAME | io_status | sql_status | +--------------+-----------+------------+ | master_3300 | ON | ON | | master_3301 | ON | ON | +--------------+-----------+------------+
标签:库存 service 语句 osi ble div ast pes 冲突
原文地址:http://www.cnblogs.com/Bccd/p/6647204.html