Documentation Home
MySQL Cluster Manager 8.4 User Manual
Related Documentation Download this Manual
PDF (US Ltr) - 1.4Mb
PDF (A4) - 1.4Mb


5.4.2 Thedelete cluster Command

delete cluster [--removedirs]cluster_name

This command deletes the cluster namedcluster_name, removing it from the list of clusters managed by MySQL Cluster Manager.

delete cluster doesnot remove any MySQL NDB Cluster binaries from hosts. However, itdoes remove the cluster configuration, data, and log files that reside in the MySQL Cluster Manager data repository.

This example demonstrates how to delete a cluster namedmycluster:

mcm> delete cluster mycluster;+------------------------------+| Command result               |+------------------------------+| Cluster deleted successfully |+------------------------------+1 row in set (1.22 sec)

A look at the MySQL Cluster Manager data repository (at/opt/mcm_data/ in this case) shows that the folder that used to host the configuration, data, and log files formycluster (/opt/mcm_data/clusters/mycluster) no longer exists:

$> ls -l /opt/mcm_data/clusterstotal 0

To remove the configuration and data files outside of the MySQL Cluster Manager data repository,delete cluster must be invoked with the--removedirs option, like this:

mcm> delete cluster --removedirs mycluster;+------------------------------+| Command result               |+------------------------------+| Cluster deleted successfully |+------------------------------+1 row in set (1.22 sec)

For example, if one of the data node onmycluster has its data directory outside of the MySQL Cluster Manager data repository:

mcm> get Datadir mycluster;+---------+---------------------------+----------+---------+----------+---------+---------+---------+| Name    | Value                     | Process1 | NodeId1 | Process2 | NodeId2 | Level   | Comment |+---------+---------------------------+----------+---------+----------+---------+---------+---------+| DataDir | /home/dso/mycluster/cdata | ndbd     | 1       |          |         | Process |         |...

Deleting mycluster without using--removedirs doesnot remove the data directory for node 1:

$> ls -l /home/dso/myclustertotal 4 drwxr-xr-x. 3 dso dso 4096 Sep 10 18:00 cdata

However, if the--removedirs option is used, the data directory for node 1 also gets removed:

$> ls -l /home/dso/myclustertotal 0

delete cluster fails if the cluster to be deleted is running, as shown here:

mcm> delete cluster mycluster;ERROR 5010 (00MGR): All processes must be stopped to delete cluster mycluster

You must shut down the cluster first, usingstop cluster.

For MySQL Cluster Manager 8.4.4 and later: Thedelete cluster command also fails if a backup of the cluster exists somewhere under/path-to-mcm-data-repository/clusters/clustername (the default arrangement). The backup should be moved to another other location or be deleted first before thedelete cluster command is executed. This is to prevent an unexpected loss of the cluster backup.