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 in Section 17.5.4, “Event Reports Generated in MySQL Cluster”; commands for creating backups and restoring from them are provided in Section 17.5.3, “Online Backup of MySQL Cluster”.
The management client has the following basic commands. In the
listing that follows, node_id
denotes
either a database node ID or the keyword ALL
,
which indicates that the command should be applied to all of the
cluster's data nodes.
HELP
Displays information on all available commands.
SHOW
Displays information on the cluster's status.
Beginning with MySQL Cluster NDB 6.2.8 and MySQL Cluster NDB 6.3.6, the output from this command indicates when the cluster is in single user mode.
In a cluster where multiple management nodes are in use, this command displays information only for data nodes that are actually connected to the current management server.
node_id
START
Brings online the data node identified by
node_id
(or all data nodes).
ALL START
works on all data nodes only, and
does not affect management nodes.
To use this command to bring a data node online, the data node must have been started using ndbd --nostart or ndbd -n.
node_id
STOP
Stops the data or management node identified by
node_id
. Note that ALL
STOP
works to stop all data nodes only, and does not
affect management nodes.
A node affected by this command disconnects from the cluster, and its associated ndbd or ndb_mgmd process terminates.
node_id
RESTART [-n] [-i]
[-a]
Restarts the data node identified by
node_id
(or all data nodes).
Using the -i
option with
RESTART
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 that 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 appropriate START
command is issued. The effect of this option is the same as
that obtained from stopping the data node and then starting it
again using ndbd --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.
node_id
STATUS
Displays status information for the data node identified by
node_id
(or for all data nodes).
Beginning with MySQL Cluster NDB 6.2.8 and MySQL Cluster NDB 6.3.6, the output from this command indicates when the cluster is in single user mode.
node_id
REPORT
report-type
Displays a report of type
report-type
for the data node
identified by node_id
, or for all
data nodes using ALL
.
Currently, there are two 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)
In MySQL Cluster NDB 7.1.1 and later, this information is
also available from the
ndbinfo.memoryusage
table; see
Section 17.5.8.6, “The ndbinfo memoryusage
Table”.
report-type
is case-insensitive and
“fuzzy”; for MemoryUsage
, you
can use MEMORY
(as shown in the prior
example), memory
, or even simply
MEM
(or mem
). You can
abbreviate BackupStatus
in a similar
fashion.
The REPORT
command was introduced in MySQL
Cluster NDB 6.2.3 and MySQL Cluster NDB 6.3.0.
ENTER SINGLE USER MODE
node_id
Enters single user mode, whereby only the MySQL server
identified by the node ID node_id
is allowed to access the database.
Currently, it is not possible in for data nodes to join a MySQL Cluster while it is running in single user mode. (Bug#20395)
EXIT SINGLE USER MODE
Exits single user mode, allowing all SQL nodes (that is, all running mysqld processes) to access the database.
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.
QUIT
, EXIT
Terminates the management client.
This command does not affect any nodes connected to the cluster.
SHUTDOWN
Shuts down all cluster data nodes and management nodes. To
exit the management client after this has been done, use
EXIT
or QUIT
.
This command does not shut down any SQL nodes or API nodes that are connected to the cluster.
CREATE NODEGROUP
nodeid
[,
nodeid
, ...]
Creates a new MySQL Cluster node group and causes data nodes to join it.
This command is used after adding new data nodes online to a MySQL Cluster, and causes them to join a new node group and thus to begin participating fully in the cluster. The command takes as its sole parameter a comma-separated list of node IDs — these are the IDs of the nodes just added and started that are to join the new node group. The number of nodes must be the same as the number of nodes in each node group that is already part of the cluster (each MySQL Cluster node group must have the same number of nodes). In other words, if the MySQL Cluster has 2 node groups of 2 data nodes each, then the new node group must also have 2 data nodes.
The node group ID of the new node group created by this command is determined automatically, and always the next highest unused node group ID in the cluster; it is not possible to set it manually.
This command was introduced in MySQL Cluster NDB 6.4.0. For more information, see Section 17.5.11, “Adding MySQL Cluster Data Nodes Online”.
DROP NODEGROUP
nodegroup_id
Drops the MySQL Cluster node group with the given
nodegroup_id
.
This command can be used to drop a node group from a MySQL
Cluster. DROP NODEGROUP
takes as its sole
argument the node group ID of the node group to be dropped.
DROP NODEGROUP
acts only to remove the data
nodes in the effected node group from that node group. It does
not stop data nodes, assign them to a different node group, or
remove them from the cluster's configuration. A data node
that does not belong to a node group is indicated in the
output of the management client
SHOW
command with
no nodegroup
in place of the node group ID,
like this (indicated using bold text):
id=3 @10.100.2.67 (5.1.44-ndb-7.0.15, no nodegroup)
Prior to MySQL Cluster NDB 7.0.4, the
SHOW
output was not
updated correctly following DROP NODEGROUP
.
(Bug#43413)
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 in the
mysql 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:
After issuing CREATE NODEGROUP
in the
ndb_mgm client, but before issuing any
ALTER ONLINE
TABLE ... REORGANIZE PARTITION
statements in the
mysql client.
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 an
NDBCLUSTER
table's
definition until a DROP TABLE
statement
is issued that causes the table metadata to be dropped.
DROP NODEGROUP
was introduced in MySQL
Cluster NDB 6.4.0. For more information, see
Section 17.5.11, “Adding MySQL Cluster Data Nodes Online”.
User Comments
Add your own comment.