Add or Remove a node in MySQL Innodb Cluster
Add or Remove a node in MySQL Innodb Cluster
Remove a node from the MySQL Innodb cluster.
mysqlsh --uri clusteradmin@mysqlhost01:3306
MySQL mysqlhost01:3306 ssl JS > cluster.status()
{
"clusterName": "mysqlcluster",
"defaultReplicaSet": {
"name": "default",
"primary": "mysqlhost01:3306",
"ssl": "REQUIRED",
"status": "OK",
"statusText": "Cluster is ONLINE and can tolerate up to ONE failure.",
"topology": {
"mysqlhost01:3306": {
"address": "mysqlhost01:3306",
"mode": "R/W",
"readReplicas": {},
"role": "HA",
"status": "ONLINE",
"version": "8.0.17"
},
"mysqlhost02:3306": {
"address": "mysqlhost02:3306",
"mode": "R/O",
"readReplicas": {},
"role": "HA",
"status": "ONLINE",
"version": "8.0.17"
},
"mysqlhost03:3306": {
"address": "mysqlhost03:3306",
"mode": "R/O",
"readReplicas": {},
"role": "HA",
"status": "ONLINE",
"version": "8.0.17"
}
},
"topologyMode": "Single-Primary"
},
"groupInformationSourceMember": "mysqlhost01:3306"
}
2) Remove the node from the cluster.
cluster.removeInstance('clusteradmin@mysqlhost03:3306')
MySQL mysqlhost01:3306 ssl JS > cluster.removeInstance('clusteradmin@mysqlhost03:3306')
The instance will be removed from the InnoDB cluster. Depending on the instance
being the Seed or not, the Metadata session might become invalid. If so, please
start a new session to the Metadata Storage R/W instance.
Instance 'mysqlhost03:3306' is attempting to leave the cluster...
The instance 'mysqlhost03:3306' was successfully removed from the cluster.
3) Check Cluster status post node removal.
MySQL mysqlhost01:3306 ssl JS > cluster.status()
{
"clusterName": "mysqlcluster",
"defaultReplicaSet": {
"name": "default",
"primary": "mysqlhost01:3306",
"ssl": "REQUIRED",
"status": "OK_NO_TOLERANCE",
"statusText": "Cluster is NOT tolerant to any failures.",
"topology": {
"mysqlhost01:3306": {
"address": "mysqlhost01:3306",
"mode": "R/W",
"readReplicas": {},
"role": "HA",
"status": "ONLINE",
"version": "8.0.17"
},
"mysqlhost02:3306": {
"address": "mysqlhost02:3306",
"mode": "R/O",
"readReplicas": {},
"role": "HA",
"status": "ONLINE",
"version": "8.0.17"
}
},
"topologyMode": "Single-Primary"
},
"groupInformationSourceMember": "mysqlhost01:3306"
}
Addition of node to the MySQL Innodb cluster.
1) Connect to primary node and check status.
mysqlsh --uri clusteradmin@mysqlhost01:3306
MySQL mysqlhost01:3306 ssl JS > cluster.status()
{
"clusterName": "mysqlcluster",
"defaultReplicaSet": {
"name": "default",
"primary": "mysqlhost01:3306",
"ssl": "REQUIRED",
"status": "OK_NO_TOLERANCE",
"statusText": "Cluster is NOT tolerant to any failures.",
"topology": {
"mysqlhost01:3306": {
"address": "mysqlhost01:3306",
"mode": "R/W",
"readReplicas": {},
"role": "HA",
"status": "ONLINE",
"version": "8.0.17"
},
"mysqlhost02:3306": {
"address": "mysqlhost02:3306",
"mode": "R/O",
"readReplicas": {},
"role": "HA",
"status": "ONLINE",
"version": "8.0.17"
}
},
"topologyMode": "Single-Primary"
},
"groupInformationSourceMember": "mysqlhost01:3306"
Please provide the password for 'clusteradmin@mysqlhost03:3306': ************************
Save password for 'clusteradmin@mysqlhost03:3306'? [Y]es/[N]o/Ne[v]er (default No):
is empty). The Shell is unable to decide whether incremental distributed state
recovery can correctly provision it.
The safest and most convenient way to provision a new instance is through
automatic clone provisioning, which will completely overwrite the state of
'mysqlhost03:3306' with a physical snapshot from an existing cluster member.
To use this method by default, set the 'recoveryMethod' option to 'clone'.
all updates ever executed in the cluster were done with GTIDs enabled, there
are no purged transactions and the new instance contains the same GTID set as
the cluster or a subset of it. To use this method by default, set the
'recoveryMethod' option to 'incremental'.
Please select a recovery method [C]lone/[I]ncremental recovery/[A]bort (default Clone):
Validating instance at mysqlhost03:3306...
A new instance will be added to the InnoDB cluster. Depending on the amount of
data on the cluster this might take from a few seconds to several hours.
Clone based state recovery is now in progress.
server does not support the RESTART command or does not come back after a
while, you may need to manually start it back.
NOTE: mysqlhost03:3306 is being cloned from mysqlhost02:3306
** Stage DROP DATA: Completed
** Clone Transfer
FILE COPY ############################################################ 100% Completed
PAGE COPY ############################################################ 100% Completed
REDO COPY ############################################################ 100% Completed
** Stage RECOVERY: \
NOTE: mysqlhost03:3306 is shutting down...
* mysqlhost03:3306 has restarted, waiting for clone to finish...
* Clone process has finished: 58.50 MB transferred in about 1 second (~inf TB/s)
{
"clusterName": "Mysqlcluster",
"defaultReplicaSet": {
"name": "default",
"primary": "mysqlhost01:3306",
"ssl": "REQUIRED",
"status": "OK",
"statusText": "Cluster is ONLINE and can tolerate up to ONE failure.",
"topology": {
"mysqlhost02:3306": {
"address": "mysqlhost02:3306",
"mode": "R/O",
"readReplicas": {},
"role": "HA",
"status": "ONLINE",
"version": "8.0.17"
},
"mysqlhost01:3306": {
"address": "mysqlhost01:3306",
"mode": "R/W",
"readReplicas": {},
"role": "HA",
"status": "ONLINE",
"version": "8.0.17"
},
"mysqlhost03:3306": {
"address": "mysqlhost03:3306",
"mode": "R/O",
"readReplicas": {},
"role": "HA",
"status": "ONLINE",
"version": "8.0.17"
}
},
"topologyMode": "Single-Primary"
},
"groupInformationSourceMember": "mysqlhost01:3306"
}
1)MySQL InnoDB Cluster node Addition Issue: - Cluster.addInstance: : MySQL server has gone away (RuntimeError)
2)Install & Configure MySQL Router - MySQL InnoDB Cluster
Comments
Post a Comment
Please do not enter any spam link in comment Section suggestions are Always Appreciated. Thanks.. !