准备环境:
os version:CentOS release 6.5 (Final)
服务器信息:
Master1:192.168.1.29
Master2:192.168.1.37
Slave:192.168.1.86
1,修改my.cnf
Slave中的my.cnf加入以下参数
启用enhanced multi-threaded slave (多线程复制)
slave-parallel-type=LOGICAL_CLOCK
slave-parallel-workers=8
master_info_repository=
TABL
relay_log_info_repository=
TABLE
relay_log_recovery=
ON
可以通过以下监控并行复制
mysql> show tables like 'replication%';
+---------------------------------------------+
| Tables_in_performance_schema (replication%) |
+---------------------------------------------+
| replication_applier_configuration |
| replication_applier_status |
| replication_applier_status_by_coordinator |
| replication_applier_status_by_worker |
| replication_connection_configuration |
| replication_connection_status |
| replication_group_member_stats |
| replication_group_members |
+----------------------------------
2,授权,在master1上和master2上授权,允许slave复制
3,change master
change master tomaster_host="192.168.1.29",master_port=3306,master_user="root",master_password="Password@123456"FOR CHANNEL "master1";
change master tomaster_host="192.168.1.37",master_port=3306,master_user="root",master_password="Password@123456"FOR CHANNEL "master2";
4,启动slave
start slave for channel "master1";
start slave for channel "master2";