delete cluster [--removedirs] cluster_name
This command deletes the cluster named
cluster_name
, removing it from the
list of clusters managed by MySQL Cluster Manager.
delete cluster
does not
remove any MySQL NDB Cluster binaries from hosts. However, it
does 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 named
mycluster
:
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
for mycluster
(/opt/mcm_data/clusters/mycluster
) no
longer exists:
$> ls -l /opt/mcm_data/clusters
total 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 on
mycluster
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
does
not remove the data directory for node 1:
$> ls -l /home/dso/mycluster
total 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/mycluster
total 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, using
stop cluster
.