You will make regular use of several commands to see the status of a cluster, to stop and start nodes, and to check on the memory usage of cluster nodes. The following sections cover them in detail.
The SHOW Command
The SHOW command shows you the current status of each node in the cluster, and if the node is connected, this command shows what version it is and so on. This is the quickest way of establishing how healthy your cluster is, and it is exceptionally useful when troubleshooting. For example, the following example tells you that you have two storage nodes starting, one management node already connected, and no SQL (sometimes referred to as "API" in the management console) nodes connected:
ndb_mgm> SHOW Cluster Configuration [ndbd(NDB)] 2 node(s) id=2 @192.168.254.13 (Version: 5.0.10, starting, Nodegroup: 0, Master) id=3 @192.168.254.11 (Version: 5.0.10, starting, Nodegroup: 0) [ndb_mgmd(MGM)] 1 node(s) id=1 @192.168.254.12 (Version: 5.0.10) [mysqld(API)] 5 node(s) id=4 (not connected, accepting connect from any host) id=5 (not connected, accepting connect from any host)
The START, STOP, and RESTART Commands
The START command starts nodes that already have the ndbd (storage node daemon) running and listening. Normally, when you run ndbd, it attempts to connect to the management node immediately, and it exits with an error if it cannot connect. If you start it with the -n ("no start") flag, it starts but waits for the management client to ask it to start.
So, if you run ndbd -n on Storage Node 3, the management client reports the following when asked to show the current status:
id=3 @192.168.254.11 (Version: 5.0.10, not started)
You can then start the node by issuing 3 START.
The management client only reports "Database node 3 is being started." You should verify that the node actually does start because the client does not hang around to tell you if the node startup fails.
The STOP command stops a storage node (the ndbd process exits). The RESTART command restarts a storage node (without the--initial parameter).
The STATUS Command
The STATUS command gives you information on the current status of a node. For example, during the startup phase, it gives you the state:
ndb_mgm> 2 STATUS Node 2: starting (Phase 2) (Version x.x.x)
Note that you can issue the command ALL instead of an ID number to get the status of all nodes (that is, ALL STATUS). This is particularly useful for detecting when nodes are in and out of single-user mode. (See the section "The ENTER SINGLE USER MODE Command" later in this appendix.)
The DUMP 1000 Command
The DUMP 1000 command causes the specified data nodes to send information to the management server about the current usage and availability of IndexMemory and DataMemory. The management node then outputs that information into the cluster log, where you can view it. This command is planned to be deprecated and replaced with a more efficient way of viewing the data in a later version of MySQL Cluster. You should never use any number other than 1000 with DUMP as doing so can lead to unwanted results.
This command is odd because it does not return the data to the management client for printing onscreen, as most other commands do. Instead, it initiates a process (which may take some time with large clusters) that records this information and then stores it in the cluster log on the management node:
ndb_mgm> ALL DUMP 1000 Sending dump signal with data: 0x000003e8 Sending dump signal with data: 0x000003e8
When you have completed the command, the cluster log contains information such as the following, where the first number is the percentage of use, and the numbers in parentheses specify the exact usage:
2005-08-22 18:22:11 [MgmSrvr] INFO -- Node 2: Data usage is 2(59 32K pages of total 2560) 2005-08-22 18:22:11 [MgmSrvr] INFO -- Node 2: Index usage is 1(42 8K pages of total 2336) 2005-08-22 18:22:12 [MgmSrvr] INFO -- Node 3: Data usage is 2(59 32K pages of total 2560) 2005-08-22 18:22:12 [MgmSrvr] INFO -- Node 3: Index usage is 1(42 8K pages of total 2336)