Restart Innodb MySQL Cluster after Complete outage(All node Down)
Restart Innodb MySQL Cluster after Complete outage(All node Down)
In DBA World, Their could be activity(like DC Migration) where all node of an MySQL Innodb cluster need to brought down. In MySQL Innodb cluster, We need to follow below steps in order to bring up cluster.
1) Start all node in the MySQL Innodb cluster.
systemctl start myql
2) Try to connect cluster using mysqlsh and check status.
3) Strat cluster using complete outage command.
Restart Cluster using below command:
var cluster = dba.rebootClusterFromCompleteOutage();
root@mysqlhost01:~# mysqlsh --uri clusteradmin@mysqlhost01:3306
Please provide the password for 'clusteradmin@mysqlhost01:3306': ************************
Save password for 'clusteradmin@mysqlhost01:3306'? [Y]es/[N]o/Ne[v]er (default No):
MySQL Shell 8.0.17
Please provide the password for 'clusteradmin@mysqlhost01:3306': ************************
Save password for 'clusteradmin@mysqlhost01:3306'? [Y]es/[N]o/Ne[v]er (default No):
MySQL Shell 8.0.17
Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.
Type '\help' or '\?' for help; '\quit' to exit.
Creating a session to 'clusteradmin@mysqlhost01:3306'
Fetching schema names for autocompletion... Press ^C to stop.
Your MySQL connection id is 15
Server version: 8.0.17 MySQL Community Server - GPL
No default schema selected; type \use <schema> to set one.
MySQL mysqlhost01:3306 ssl JS >
MySQL mysqlhost01:3306 ssl JS > var cluster = dba.getCluster()
Dba.getCluster: This function is not available through a session to a standalone instance (metadata exists, instance belongs to that metadata, but GR is not active) (RuntimeError)
MySQL mysqlhost01:3306 ssl JS > cluster.status();
TypeError: Cannot read property 'status' of undefined
MySQL mysqlhost01:3306 ssl JS > var cluster = dba.rebootClusterFromCompleteOutage();
Reconfiguring the default cluster from complete outage...
Creating a session to 'clusteradmin@mysqlhost01:3306'
Fetching schema names for autocompletion... Press ^C to stop.
Your MySQL connection id is 15
Server version: 8.0.17 MySQL Community Server - GPL
No default schema selected; type \use <schema> to set one.
MySQL mysqlhost01:3306 ssl JS >
MySQL mysqlhost01:3306 ssl JS > var cluster = dba.getCluster()
Dba.getCluster: This function is not available through a session to a standalone instance (metadata exists, instance belongs to that metadata, but GR is not active) (RuntimeError)
MySQL mysqlhost01:3306 ssl JS > cluster.status();
TypeError: Cannot read property 'status' of undefined
MySQL mysqlhost01:3306 ssl JS > var cluster = dba.rebootClusterFromCompleteOutage();
Reconfiguring the default cluster from complete outage...
The instance 'mysqlhost02:3306' was part of the cluster configuration.
Would you like to rejoin it to the cluster? [y/N]: y
Would you like to rejoin it to the cluster? [y/N]: y
The instance 'mysqlhost03:3306' was part of the cluster configuration.
Would you like to rejoin it to the cluster? [y/N]: y
Would you like to rejoin it to the cluster? [y/N]: y
The safest and most convenient way to provision a new instance is through
automatic clone provisioning, which will completely overwrite the state of
'mysqlhost01:3306' with a physical snapshot from an existing cluster member.
To use this method by default, set the 'recoveryMethod' option to 'clone'.
automatic clone provisioning, which will completely overwrite the state of
'mysqlhost01:3306' with a physical snapshot from an existing cluster member.
To use this method by default, set the 'recoveryMethod' option to 'clone'.
The incremental distributed state recovery may be safely used if you are sure
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'.
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'.
Incremental distributed state recovery was selected because it seems to be safely usable.
The cluster was successfully rebooted.
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"
}
{
"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"
}
you can learn more about MySql and InnoDB from below books:
=================================================================
You can also , Visit our Blogs for related topic on MySQL InnoDB Cluster:
1)MySQL InnoDB Cluster node Addition Issue: - Cluster.addInstance: : MySQL server has gone away (RuntimeError)
2)Install & Configure MySQL Router - MySQL InnoDB Cluster
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.. !