mysql> stop group_replication; mysql> set global group_replication_single_primary_mode=OFF; mysql> set global group_replication_enforce_update_everywhere_checks=ON;
2、随便选择某个节点执行
1 2 3
mysql> SET GLOBAL group_replication_bootstrap_group=ON; mysql> START GROUP_REPLICATION; mysql> SET GLOBAL group_replication_bootstrap_group=OFF;
3、其他节点执行
1
mysql> START GROUP_REPLICATION;
查看节点启动报错:
1 2
2018-11-08T14:00:52.098660Z 56 [ERROR] Plugin group_replication reported: 'There was an error when connecting to the donor server. Please check that group_replication_recovery channel credentials and all MEMBER_HOST column values of performance_schema.replication_group_members table are correct and DNS resolvable.' 2018-11-08T14:00:52.098689Z 56 [ERROR] Plugin group_replication reported: 'For details please check performance_schema.replication_connection_status table and error log messages of Slave I/O for channel group_replication_recovery.'
手动配置复制信息:
1
change master to master_user='repl',master_password='12345678' for channel 'group_replication_recovery';
MySQL dax-mysql-master:3306 JS > cluster = dba.getCluster("prodCluster") <Cluster:prodCluster>
MySQL dax-mysql-master:3306 JS > cluster.status(); Cluster.status: The InnoDB Cluster topology type (Single-Master) does not match the current Group Replication configuration (Multi-Master). Please use <cluster>.rescan() or change the Group Replication configuration accordingly. (RuntimeError)
MySQL dax-mysql-master:3306 JS > cluster.rescan() Rescanning the cluster...
Result of the rescanning operation: { "defaultReplicaSet": { "name": "default", "newlyDiscoveredInstances": [], "unavailableInstances": [] } }
再次查看集群状态仍然报错:
1 2
MySQL dax-mysql-master:3306 JS > cluster.status(); Cluster.status: The InnoDB Cluster topology type (Single-Master) does not match the current Group Replication configuration (Multi-Master). Please use <cluster>.rescan() or change the Group Replication configuration accordingly. (RuntimeError)
尝试删除集群元数据:
1 2 3
dba.dropMetadataSchema(); Are you sure you want to remove the Metadata? [y/N]: y Metadata Schema successfully removed.
重新创建集群
1
var cluster = dba.createCluster('prodCluster', {adoptFromGR: true ,force: true});
报错提示:
1
[ERROR] Plugin group_replication reported: 'Table instances has a foreign key with 'CASCADE' clause. This is not compatible with Group Replication'
ALTER TABLE `mysql_innodb_cluster_metadata`.`instances` DROP FOREIGN KEY `instances_ibfk_1`; ALTER TABLE `mysql_innodb_cluster_metadata`.`instances` DROP FOREIGN KEY `instances_ibfk_2`;
MySQL dax-mysql-master:3306 JS > var cluster = dba.createCluster('prodCluster', {adoptFromGR: true ,force: true}); A new InnoDB cluster will be created based on the existing replication group on instance 'repl@dax-mysql-master:3306'.
mysql> stop group_replication; mysql> set global group_replication_enforce_update_everywhere_checks=OFF; mysql> set global group_replication_single_primary_mode=ON;
8、主节点(dax-mysql-master)执行
1 2 3
SET GLOBAL group_replication_bootstrap_group=ON; START GROUP_REPLICATION; SET GLOBAL group_replication_bootstrap_group=OFF;
show status like '%primary%'; +----------------------------------+--------------------------------------+ | Variable_name | Value | +----------------------------------+--------------------------------------+ | group_replication_primary_member | d5bd8edd-9a1d-11e8-993e-525400578639 | +----------------------------------+--------------------------------------+ 1 row in set (0.01 sec)
MySQL dax-mysql-master:3306 JS > cluster = dba.getCluster("prodCluster") <Cluster:prodCluster>
MySQL dax-mysql-master:3306 JS > cluster.status(); Cluster.status: The InnoDB Cluster topology type (Multi-Master) does not match the current Group Replication configuration (Single-Master). Please use <cluster>.rescan() or change the Group Replication configuration accordingly. (RuntimeError)
MySQL dax-mysql-master:3306 JS > cluster.rescan() Rescanning the cluster...
Result of the rescanning operation: { "defaultReplicaSet": { "name": "default", "newlyDiscoveredInstances": [], "unavailableInstances": [] } }
MySQL dax-mysql-master:3306 JS > cluster.status(); Cluster.status: The InnoDB Cluster topology type (Multi-Master) does not match the current Group Replication configuration (Single-Master). Please use <cluster>.rescan() or change the Group Replication configuration accordingly. (RuntimeError)
跟多主切换为单主报错相同,尝试删除集群元数据:
1 2 3
dba.dropMetadataSchema(); Are you sure you want to remove the Metadata? [y/N]: y Metadata Schema successfully removed.
重新创建集群:
1 2 3 4 5 6 7 8
MySQL dax-mysql-master:3306 JS > var cluster = dba.createCluster('prodCluster', {adoptFromGR: true}); A new InnoDB cluster will be created based on the existing replication group on instance 'repl@dax-mysql-master:3306'.