The following sections cover some other commands that you may find useful.
The ENTER SINGLE USER MODE Command
Single-user mode allows you to restrict database system access to a single SQL node. When you enter single-user mode, all connections to all other SQL nodes are closed gracefully, and all running transactions are aborted. No new transactions are allowed to be started.
Entering single-user mode is pretty straightforward:
ndb_mgm> ENTER SINGLE USER MODE 4 Entering single user mode Access will be granted for API node 4 only. Use ALL STATUS to see when single user mode has been entered.
When the cluster has entered single-user mode, only the designated SQL node is granted access to the database. You can use the ALL STATUS command to see when the cluster has entered single-user mode:
ndb_mgm> ALL STATUS Node 2: single user mode (Version 5.0.10) Node 3: single user mode (Version 5.0.10)
This shows you when the storage nodes have switched over to single-user mode. So in this example, the storage nodes have IDs of 2 and 3.
The EXIT SINGLE USER MODE Command
The EXIT SINGLE USER MODE command returns to normal mode. SQL nodes waiting for a connection (that is, for the cluster to become ready and available) are then allowed to connect. The MySQL server denoted as the single-user SQL node continues to run (if it is connected) during and after the change.
The SHUTDOWN Command
The SHUTDOWN command shuts down all nodes in the cluster, including the management daemon and all storage nodes. Note that it does not actually stop SQL nodes (MySQL servers), but it does remove their ability to do anything to tables in the cluster. Note that you cannot run this command when in single-user mode.
Running this command is fairly straightforward:
ndb_mgm> shutdown 2 NDB Cluster storage node(s) have shutdown. NDB Cluster management server shutdown.
The PURGE STALE SESSIONS Command
The PURGE STALE SESSIONS command is used in some older versions of MySQL Cluster to fix a bug. It resets reserved node IDs that should be reset each time a node shuts down but sometimes are not. Normally, this command returns "No sessions purged." If you have problems connecting a node, with errors implying that it is already connected, you can try this command to see if it fixes the problem. This command is not dangerous and will not cause your cluster any damage; the worst-case scenario is that it may do nothing at all. Typically, it will return the following output, which means that it has done nothing:
ndb_mgm> PURGE STALE SESSIONS; No sessions purged
The START BACKUP Command
The START BACKUP command causes MySQL Cluster to begin making a backup. You can use an optional parameter with START BACKUP to determine what action to take after starting the backup. The three possible options are NOWAIT, WAIT STARTED, and WAIT COMPLETED. If you do not specify a level, the default is WAIT COMPLETED. If you specify the NOWAIT option, the START BACKUP command returns immediately, while the request is sent to the management daemon to start the backup. WAIT STARTED causes the command to return after all the data nodes acknowledge the command to begin the backup. Finally, WAIT COMPLETED returns only after all the data nodes have confirmed that the backup completed successfully.
In most cases, you will want to use WAIT COMPLETED, which tells you when the backup completes:
ndb_mgm> START BACKUP WAIT COMPLETED Waiting for completed, this may take several minutes Node 2: Backup 6 started from node 1 Node 2: Backup 6 started from node 1 completed StartGCP: 1580 StopGCP: 1583 #Records: 4098 #LogRecords: 0 Data: 65688 bytes Log: 0 bytes
The ABORT BACKUP Command
The ABORT BACKUP command causes the nodes to interrupt the backup in progress. It is not possible to resume after the abort, and a new START BACKUP is required to begin a new backup process. You can use ABORT BACKUP on backup IDs that are not in progress without getting any errors. If you successfully abort a backup, you get a message confirming that it was successful. For example, to abort backup ID 10, you would use the following command:
ndb_mgm> ABORT BACKUP 10 Abort of backup 10 ordered Node 2: Backup 10 started from 1 has been aborted. Error: 1321
Installation
Configuration
Backup and Recovery
Security and Management
Performance
Troubleshooting
Common Setups
A MySQL Cluster Binaries
B Management Commands
C Glossary of Cluster Terminology
Index