5.6.7 The remove process Command

remove process [--removedirs] process_id_list cluster_name

process_id_list:
    process_id[, process_id[, ...]]

This command removes permanently the processes in the process_id_list from the cluster named cluster_name. It provides a means to scale down a cluster offline.

If the --removedirs option is used, all data for the specified processes will be deleted.

The following restrictions apply when using this command:

  1. The cluster must be in the status of created or stopped.

  2. The processes to be removed must be in the status of stopped, added, or import.

  3. The command cannot remove all processes from a cluster in the created status; at least one process must be left.

  4. The command cannot remove all process of the same type from a cluster in the stopped status; at least one process must be left in the cluster for each type of nodes (management, data, and API).

  5. The command cannot remove a data node that is in the stopped status if it is already a member of a node group (i.e., if it has ever been started and was fully functional).

You can use the show status --process or list processes command to obtain the process IDs for all the processes in a given cluster:

mcm> show status --process mycluster;
+--------+----------+---------+--------+-----------+-----------+
| NodeId | Process  | Host    | Status | Nodegroup | Package   |
+--------+----------+---------+--------+-----------+-----------+
| 49     | ndb_mgmd | flundra | added  |           | mypackage |
| 1      | ndbmtd   | flundra | added  | n/a       | mypackage |
| 2      | ndbmtd   | flundra | added  | n/a       | mypackage |
| 50     | mysqld   | flundra | added  |           | mypackage |
| 51     | mysqld   | flundra | added  |           | mypackage |
| 52     | ndbapi   | *       | added  |           |           |
| 53     | ndbapi   | *       | added  |           |           |
+--------+----------+---------+--------+-----------+-----------+
7 rows in set (0.03 sec)

The process IDs are the same as the node IDs for the processes shown in the output of the above or some other mcm client commands, or in the output of the ndb_mgm -e "show" command (see ndb_mgm — The NDB Cluster Management Client). In the above example, the SQL node with the process ID 50 in mycluster can be removed by the following command:

mcm> remove process 50 mycluster;
+------------------------------+
| Command result               |
+------------------------------+
| Process removed successfully |
+------------------------------+
1 row in set (0.48 sec)

And in this case, since the cluster was never started, we may also remove both data nodes:

mcm> remove process 1,2 mycluster;
+------------------------------+
| Command result               |
+------------------------------+
| Process removed successfully |
+------------------------------+
1 row in set (0.40 sec)