20.2.6 Adopting a Group Replication Deployment
If you have an existing deployment of Group Replication and you want to use it to create a cluster, pass the adoptFromGR
option to the dba.createCluster()
function. The created InnoDB cluster matches whether the replication group is running as single-primary or multi-primary.
Group Replication members might contain MyISAM
tables. Convert all such tables to InnoDB
before adopting the group to an InnoDB cluster.
To adopt an existing Group Replication group, connect to a group member using MySQL Shell. In the following example a single-primary group is adopted. We connect to gr-member-2
, a secondary instance, while gr-member-1
is functioning as the group's primary. Create a cluster using dba.createCluster()
, passing in the adoptFromGR
option. For example:
mysql-js> var cluster = dba.createCluster('prodCluster', {adoptFromGR: true});
A new InnoDB cluster will be created on instance 'root@gr-member-2:3306'.
Creating InnoDB cluster 'prodCluster' on 'root@gr-member-2:3306'...
Adding Seed Instance...
Cluster successfully created. Use cluster.addInstance() to add MySQL instances.
At least 3 instances are needed for the cluster to be able to withstand up to
one server failure.
If the instance has super_read_only=ON
then you might need to confirm that AdminAPI can set super_read_only=OFF
. See Super Read-only and Instances for more information.
The new cluster matches the mode of the group. If the adopted group was running in single-primary mode then a single-primary cluster is created. If the adopted group was running in multi-primary mode then a multi-primary cluster is created. For example:
mysql-js> cluster.status();
{
"clusterName": "prodCluster",
"defaultReplicaSet": {
"name": "default",
"primary": "gr-member-1:3306",
"ssl": "REQUIRED",
"status": "OK",
"statusText": "Cluster is ONLINE and can tolerate up to ONE failure.",
"topology": {
"gr-member-2:3306": {
"address": "gr-member-2:3306",
"mode": "R/O",
"readReplicas": {},
"role": "HA",
"status": "ONLINE"
},
"gr-member-1:3306": {
"address": "gr-member-1:3306",
"mode": "R/W",
"readReplicas": {},
"role": "HA",
"status": "ONLINE"
},
"gr-member-3:3306": {
"address": "gr-member-3:3306",
"mode": "R/O",
"readReplicas": {},
"role": "HA",
"status": "ONLINE"
}
}
}
}
As seen above, the newly created cluster is single-primary and uses gr-member-1
as the primary.