10bet网址
MySQL Cluster Manager 1.4 User Manual
Related Documentation Download this Manual
PDF (US Ltr)- 1.8Mb
PDF (A4)- 1.8Mb


4.6.2 Thechange processCommand

change process [--sequential-restart]old_proc_type[:proc-id]=new_proc_typecluster_nameold_proc_type|new_proc_type: {ndbd|ndbmtd}

This command is used (MySQL NDB Cluster 7.0 and later) to change the process type for a given MySQL NDB Cluster process or group of MySQL NDB Cluster processes from one process type (old-process-type) to another process type (new-process-type).

Currently, the only two process types available for use with this command arendbdandndbmtd. This means thatchange processcan be used to change the data node process running on one or more data nodes from the single-threaded data node daemon (ndbd) to the multithreaded data node daemon (ndbmtd) or vice versa.

By default,change processaffects all data nodes running theold-process-type. By specifying an optionalprocess_id, its action can be restricted to the data node having that process ID.

Suppose you have a cluster that is namedmyclusterand has two data nodes usingndbdprocesses, as reflected in the output of the followingshow statuscommand:

mcm> show status --process mycluster; +--------+----------+----------+----------+-----------+ | NodeId | Process | Host | Status | Nodegroup | +--------+----------+----------+----------+-----------+ | 49 | ndb_mgmd | flundra | running | | | 1 | ndbd | tonfisk | running | n/a | | 2 | ndbd | grindval | running | n/a | | 50 | mysqld | haj | running | | | 51 | mysqld | torsk | running | | | 52 | ndbapi | * | running | | +--------+----------+----------+----------+-----------+ 6 rows in set (0.06 sec)

To change both data nodes to so that they use multithreaded (ndbmtd) processes, issue the command shown here, without anyprocess_idspecifier:

cha mcm >nge process ndbd=ndbmtd mycluster; +------------------------------+ | Command result | +------------------------------+ | Process changed successfully | +------------------------------+ 1 row in set (2 min 17.51 sec)

After the command has executed, you can verify that both data nodes are now usingndbmtdby checking the output of the appropriateshow statuscommand, as shown here:

mcm> show status --process mycluster; +--------+----------+----------+----------+-----------+ | NodeId | Process | Host | Status | Nodegroup | +--------+----------+----------+----------+-----------+ | 49 | ndb_mgmd | flundra | running | | | 1 | ndbmtd | tonfisk | running | n/a | | 2 | ndbmtd | grindval | running | n/a | | 50 | mysqld | haj | running | | | 51 | mysqld | torsk | running | | | 52 | ndbapi | * | running | | +--------+----------+----------+----------+-----------+ 6 rows in set (0.09 sec)

A rolling restart for the cluster is performed at the end of thechange processcommand.For MySQL Cluster Manager 1.4.8 and later,use the--sequential-restartoption to make the rolling restart asequentialone.

Note

Thechange processcommand can be used whether or not the cluster or the data node or data nodes to be changed are running. However, the command executes much more quickly if the data node or data nodes to be changed are not running. The next set of examples illustrates this.

It is possible (and sometimes desirable) to usendbdandndbmtddata node processes concurrently; thus, it is also possible using thechange process commandto change a single data node process from single-threaded to multithreaded, or from multithreaded to single-threaded. To do this, you must specify the data node process using its process ID.

First, we stop the cluster and verify that all processes are no longer running, as shown here:

mcm> stop cluster mycluster; +------------------------------+ | Command result | +------------------------------+ | Cluster stopped successfully | +------------------------------+ 1 row in set (22.93 sec) mcm> show status --process mycluster; +--------+----------+----------+----------+-----------+ | NodeId | Process | Host | Status | Nodegroup | +--------+----------+----------+----------+-----------+ | 49 | ndb_mgmd | flundra | stopped | | | 1 | ndbmtd | tonfisk | stopped | n/a | | 2 | ndbmtd | grindval | stopped | n/a | | 50 | mysqld | haj | stopped | | | 51 | mysqld | torsk | stopped | | | 52 | ndbapi | * | stopped | | +--------+----------+----------+----------+-----------+ 6 rows in set (0.05 sec)

The following command changes only the node having the process ID2from using the multithreaded data node daemon to the single-threaded version:

cha mcm >nge process ndbmtd:2=ndbd mycluster; +------------------------------+ | Command result | +------------------------------+ | Process changed successfully | +------------------------------+ 1 row in set (6.52 sec)

As you can see,change processoperates much more quickly when the process to be changed is not running. As before, you can verify that the command succeeded usingshow status:

mcm> show status --process mycluster; +--------+----------+----------+----------+-----------+ | NodeId | Process | Host | Status | Nodegroup | +--------+----------+----------+----------+-----------+ | 49 | ndb_mgmd | flundra | stopped | | | 1 | ndbmtd | tonfisk | stopped | n/a | | 2 | ndbd | grindval | stopped | n/a | | 50 | mysqld | haj | stopped | | | 51 | mysqld | torsk | stopped | | | 52 | ndbapi | * | stopped | | +--------+----------+----------+----------+-----------+ 6 rows in set (0.07 sec)

To complete the example, we start the cluster again, usingstart cluster, then change node number 2 back fromndbd(single-threaded) tondbmtd(multithreaded) usingchange process, then verify the change usingshow status:

mcm> start cluster mycluster; +------------------------------+ | Command result | +------------------------------+ | Cluster started successfully | +------------------------------+ 1 row in set (36.43 sec) mcm> change process ndbd:2=ndbmtd mycluster; +------------------------------+ | Command result | +------------------------------+ | Process changed successfully | +------------------------------+ 1 row in set (2 min 10.41 sec) mcm> show status --process mycluster; +--------+----------+----------+----------+-----------+ | NodeId | Process | Host | Status | Nodegroup | +--------+----------+----------+----------+-----------+ | 49 | ndb_mgmd | flundra | running | | | 1 | ndbmtd | tonfisk | running | n/a | | 2 | ndbmtd | grindval | running | n/a | | 50 | mysqld | haj | running | | | 51 | mysqld | torsk | running | | | 52 | ndbapi | * | running | | +--------+----------+----------+----------+-----------+ 6 rows in set (0.11 sec)

You can see that it can require much less time to stop the cluster, change a data node process, and then start the cluster again than it is to change the process while the cluster is running. However, if you do this, the cluster is not available while it is stopped.

As noted previously,change processworks only withndbdandndbmtdprocesses; attempting to use any other process type causes the command to fail with an error, as shown here:

mcm >变化过程ndb_mgmd = mysqld mycluster;犯错OR 7009 (00MGR): Processes ndb_mgmd and mysqld are not interchangeable in this package mcm> change process ndbd=mysqld mycluster; ERROR 7009 (00MGR): Processes ndbd and mysqld are not interchangeable in this package