21.6.1 Commands in the NDB Cluster Management Client (original) (raw)

21.6.1 Commands in the NDB Cluster Management Client

In addition to the central configuration file, a cluster may also be controlled through a command-line interface available through the management client ndb_mgm. This is the primary administrative interface to a running cluster.

Commands for the event logs are given inSection 21.6.3, “Event Reports Generated in NDB Cluster”; commands for creating backups and restoring from them are provided inSection 21.6.8, “Online Backup of NDB Cluster”.

Using ndb_mgm with MySQL Cluster Manager. MySQL Cluster Manager handles starting and stopping processes and tracks their states internally, so it is not necessary to usendb_mgm for these tasks for an NDB Cluster that is under MySQL Cluster Manager control. it is recommended_not_ to use the ndb_mgm command-line client that comes with the NDB Cluster distribution to perform operations that involve starting or stopping nodes. These include but are not limited to theSTART,STOP,RESTART, andSHUTDOWN commands. For more information, see MySQL Cluster Manager Process Commands.

The management client has the following basic commands. In the listing that follows, nodeid denotes either a data node ID or the keyword ALL, which indicates that the command should be applied to all of the cluster's data nodes.

id=3    @10.100.2.67  (5.7.44-ndb-7.5.36, no nodegroup)  

DROP NODEGROUP works only when all data nodes in the node group to be dropped are completely empty of any table data and table definitions. Since there is currently no way using ndb_mgm or themysql client to remove all data from a specific data node or node group, this means that the command succeeds only in the two following cases:
1. After issuing CREATE NODEGROUP in the ndb_mgm client, but before issuing anyALTER TABLE ... REORGANIZE PARTITION statements in themysql client.
2. After dropping all NDBCLUSTER tables using DROP TABLE.
TRUNCATE TABLE does not work for this purpose because this removes only the table data; the data nodes continue to store anNDBCLUSTER table's definition until a DROP TABLE statement is issued that causes the table metadata to be dropped.
For more information about DROP NODEGROUP, see Section 21.6.7, “Adding NDB Cluster Data Nodes Online”. * ENTER SINGLE USER MODE_node_id_
Enters single user mode, whereby only the MySQL server identified by the node ID nodeid is permitted to access the database. * EXIT SINGLE USER MODE
Exits single user mode, enabling all SQL nodes (that is, all running mysqld processes) to access the database.
Note
It is possible to use EXIT SINGLE USER MODE even when not in single user mode, although the command has no effect in this case. * HELP
Displays information on all available commands. * node_id NODELOG DEBUG {ON|OFF}
Toggles debug logging in the node log, as though the effected data node or nodes had been started with the--verbose option.NODELOG DEBUG ON starts debug logging;NODELOG DEBUG OFF switches debug logging off.
This command was added in NDB 7.6. * PROMPT [prompt]
Changes the prompt shown by ndb_mgm to the string literal prompt.
prompt should not be quoted (unless you want the prompt to include the quotation marks). Unlike the case with the mysql client, special character sequences and escapes are not recognized. If called without an argument, the command resets the prompt to the default value (ndb_mgm>).
Some examples are shown here:
ndb_mgm> PROMPT mgm#1: mgm#1: SHOW Cluster Configuration ... mgm#1: PROMPT mymgm > mymgm > PROMPT 'mymgm:' 'mymgm:' PROMPT mymgm: mymgm: PROMPT ndb_mgm> EXIT $>
Note that leading spaces and spaces within the_prompt_ string are not trimmed. Trailing spaces are removed.
The PROMPT command was added in NDB 7.5.0. * QUIT,EXIT
Terminates the management client.
This command does not affect any nodes connected to the cluster. * node_id REPORT report-type
Displays a report of type_report-type_ for the data node identified by nodeid, or for all data nodes using ALL.
Currently, there are three accepted values for_report-type:
* BackupStatus provides a status report on a cluster backup in progress
* MemoryUsage displays how much data memory and index memory is being used by each data node as shown in this example:
ndb_mgm> ALL REPORT MEMORY Node 1: Data usage is 5%(177 32K pages of total 3200) Node 1: Index usage is 0%(108 8K pages of total 12832) Node 2: Data usage is 5%(177 32K pages of total 3200) Node 2: Index usage is 0%(108 8K pages of total 12832)
This information is also available from thendbinfo.memoryusage table.
* EventLog reports events from the event log buffers of one or more data nodes.
report-type is case-insensitive and“fuzzy”; for MemoryUsage, you can use MEMORY (as shown in the prior example), memory, or even simplyMEM (or mem). You can abbreviate BackupStatus in a similar fashion. * node_id RESTART [-n] [-i] [-a] [-f]
Restarts the data node identified by
nodeid_ (or all data nodes).
Using the -i option withRESTART causes the data node to perform an initial restart; that is, the node's file system is deleted and recreated. The effect is the same as that obtained from stopping the data node process and then starting it again using ndbd --initial from the system shell.
Note
Backup files and Disk Data files are not removed when this option is used.
Using the -n option causes the data node process to be restarted, but the data node is not actually brought online until the appropriateSTART command is issued. The effect of this option is the same as that obtained from stopping the data node and then starting it again usingndbd --nostart or ndbd -n from the system shell.
Using the -a causes all current transactions relying on this node to be aborted. No GCP check is done when the node rejoins the cluster.
Normally, RESTART fails if taking the node offline would result in an incomplete cluster. The-f option forces the node to restart without checking for this. If this option is used and the result is an incomplete cluster, the entire cluster is restarted. * SHOW
Displays basic information about the cluster and cluster nodes. For all nodes, the output includes the node's ID, type, and NDB software version. If the node is connected, its IP address is also shown; otherwise the output shows not connected, accepting connect from_`ipaddress`_, withany host used for nodes that are permitted to connect from any address.
In addition, for data nodes, the output includesstarting if the node has not yet started, and shows the node group of which the node is a member. If the data node is acting as the master node, this is indicated with an asterisk (*).
Consider a cluster whose configuration file includes the information shown here (possible additional settings are omitted for clarity):
[ndbd default] DataMemory= 128G NoOfReplicas= 2 [ndb_mgmd] NodeId=50 HostName=198.51.100.150 [ndbd] NodeId=5 HostName=198.51.100.10 DataDir=/var/lib/mysql-cluster [ndbd] NodeId=6 HostName=198.51.100.20 DataDir=/var/lib/mysql-cluster [ndbd] NodeId=7 HostName=198.51.100.30 DataDir=/var/lib/mysql-cluster [ndbd] NodeId=8 HostName=198.51.100.40 DataDir=/var/lib/mysql-cluster [mysqld] NodeId=100 HostName=198.51.100.100 [api] NodeId=101
After this cluster (including one SQL node) has been started,SHOW displays the following output:
```
ndb_mgm> SHOW
Connected to Management Server at: localhost:1186
Cluster Configuration

[ndbd(NDB)] 4 node(s)
id=5 @198.51.100.10 (5.7.44-ndb-7.6.34, Nodegroup: 0, *)
id=6 @198.51.100.20 (5.7.44-ndb-7.6.34, Nodegroup: 0)
id=7 @198.51.100.30 (5.7.44-ndb-7.6.34, Nodegroup: 1)
id=8 @198.51.100.40 (5.7.44-ndb-7.6.34, Nodegroup: 1)
[ndb_mgmd(MGM)] 1 node(s)
id=50 @198.51.100.150 (5.7.44-ndb-7.6.34)
[mysqld(API)] 2 node(s)
id=100 @198.51.100.100 (5.7.44-ndb-7.6.34)
id=101 (not connected, accepting connect from any host)

```
The output from this command also indicates when the cluster is in single user mode (see the description of theENTER SINGLE USER MODE command, as well asSection 21.6.6, “NDB Cluster Single User Mode”).

Additional commands. A number of other commands available in thendb_mgm client are described elsewhere, as shown in the following list: