Dissolve MySQL Innodb Cluster

Dissolve MySQL Innodb Cluster 


In database world ,Decommissioning a database and DB Cluster is a regular activity. In case of MySQL Innodb cluster decommission a cluster is known as Dissolving a cluster. In this blog , We will discuss about how to dissolve a MySQL InnoDb Cluster.

Dissolving MySQL InnoDB Cluster


To dissolve an InnoDB cluster you connect to a read-write instance, for example the primary in a single-primary cluster, and use the Cluster.dissolve() command. This removes all metadata and configuration associated with the cluster, and disables Group Replication on the instances. Any data that was replicated between the instances is not removed. There is no way to undo the dissolving of a cluster, therefore you must pass force: true to confirm you want to dissolve the cluster. For example: to create it again use dba.createCluster().

var cluster = dba.getCluster()

mysql-js> cluster.dissolve({force:true})

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

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.

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 590
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 >
 MySQL  mysqlhost01:3306 ssl  JS > cluster.dissolve({force:true});
ReferenceError: cluster is not defined
 MySQL  mysqlhost01:3306 ssl  JS > var cluster = dba.getCluster()
 MySQL  mysqlhost01:3306 ssl  JS > cluster.dissolve({force:true});
The cluster still has the following registered ReplicaSets:
{
    "clusterName": "MySQLCluster",
    "defaultReplicaSet": {
        "name": "default",
        "topology": [
            {
                "address": "mysqlhost02:3306",
                "label": "mysqlhost02:3306",
                "role": "HA",
                "version": "8.0.17"
            },
            {
                "address": "mysqlhost01:3306",
                "label": "mysqlhost01:3306",
                "role": "HA",
                "version": "8.0.17"
            }
        ],
        "topologyMode": "Single-Primary"
    }
}
WARNING: You are about to dissolve the whole cluster and lose the high availability features provided by it. This operation cannot be reverted. All members will be removed from their ReplicaSet and replication will be stopped, internal recovery user accounts and the cluster metadata will be dropped. User data will be maintained intact in all instances.

Are you sure you want to dissolve the cluster? [y/N]: Y

Instance 'mysqlhost02:3306' is attempting to leave the cluster...
Instance 'mysqlhost01:3306' is attempting to leave the cluster...

The cluster was successfully dissolved.
Replication was disabled but user data was left intact.

 MySQL  mysqlhost01:3306 ssl  JS >

Once above step is done, You can decommission individual node after erasing data from the MySQL data-dir directory.  


you can learn more about MySql and InnoDB from below books:

=================================================================





Comments

Popular posts from this blog

Restart Innodb MySQL Cluster after Complete outage(All node Down)

Oracle Block Corruption - Detection and Resolution

Add or Remove a node in MySQL Innodb Cluster