Table of Contents
Using and managing an NDB Cluster requires several specialized programs, which we describe in this chapter. We discuss the purposes of these programs in an NDB Cluster, how to use the programs, and what startup options are available for each of them.
These programs include the NDB Cluster data, management, and SQL node processes (ndbd, ndbmtd, ndb_mgmd, and mysqld) and the management client (ndb_mgm).
For information about using mysqld as an NDB Cluster process, see Section 7.4, “MySQL Server Usage for NDB Cluster”.
Other NDB utility, diagnostic, and
example programs are included with the NDB Cluster distribution.
These include ndb_restore,
ndb_show_tables, and
ndb_config. These programs are also covered in
this section.
The final portion of this section contains tables of options that are common to all the various NDB Cluster programs.
ndbd is the process that is used to handle all the data in tables using the NDB Cluster storage engine. This is the process that empowers a data node to accomplish distributed transaction handling, node recovery, checkpointing to disk, online backup, and related tasks.
In an NDB Cluster, a set of ndbd processes cooperate in handling data. These processes can execute on the same computer (host) or on different computers. The correspondences between data nodes and Cluster hosts is completely configurable.
The following table includes command options specific to the NDB Cluster data node program ndbd. Additional descriptions follow the table. For options common to most NDB Cluster programs (including ndbd), see Section 6.26, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.
Table 6.1 This table describes command-line options for the ndbd program
| Format | Description | Added or Removed |
|---|---|---|
| Perform initial start of ndbd, including cleaning the file system. Consult the documentation before using this option | All MySQL 5.5 based releases |
|
| Don't start ndbd immediately; ndbd waits for command to start from ndb_mgmd | All MySQL 5.5 based releases |
|
| Start ndbd as daemon (default); override with --nodaemon | All MySQL 5.5 based releases |
|
| Do not start ndbd as daemon; provided for testing purposes | All MySQL 5.5 based releases |
|
| Run ndbd in foreground, provided for debugging purposes (implies --nodaemon) | All MySQL 5.5 based releases |
|
| Do not wait for these data nodes to start (takes comma-separated list of node IDs). Also requires --ndb-nodeid to be used. | All MySQL 5.5 based releases |
|
| Perform partial initial start (requires --nowait-nodes) | All MySQL 5.5 based releases |
|
| Local bind address | All MySQL 5.5 based releases |
|
| Used to install the data node process as a Windows service. Does not apply on non-Windows platforms. | All MySQL 5.5 based releases |
|
| Used to remove a data node process that was previously installed as a Windows service. Does not apply on non-Windows platforms. | All MySQL 5.5 based releases |
|
| Set the number of times to retry a connection before giving up; 0 means 1 attempt only (and no retries) | ADDED: NDB 7.2.9 |
|
| Time to wait between attempts to contact a management server, in seconds; 0 means do not wait between attempts | ADDED: NDB 7.2.9 |
All of these options also apply to the multi-threaded version of this program (ndbmtd) and you may substitute “ndbmtd” for “ndbd” wherever the latter occurs in this section.
| Command-Line Format | --bind-address=name | ||
| Permitted Values | Type | string | |
| Default | | ||
Causes ndbd to bind to a specific network interface (host name or IP address). This option has no default value.
| Command-Line Format | --daemon | ||
| Permitted Values | Type | boolean | |
| Default | TRUE | ||
Instructs ndbd or
ndbmtd to execute as a daemon process.
This is the default behavior.
--nodaemon can be used to
prevent the process from running as a daemon.
This option has no effect when running ndbd or ndbmtd on Windows platforms.
| Command-Line Format | --nodaemon | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
Prevents ndbd or
ndbmtd from executing as a daemon
process. This option overrides the
--daemon option. This is useful
for redirecting output to the screen when debugging the
binary.
The default behavior for ndbd and ndbmtd on Windows is to run in the foreground, making this option unnecessary on Windows platforms, where it has no effect.
| Command-Line Format | --foreground | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
Causes ndbd or ndbmtd
to execute as a foreground process, primarily for debugging
purposes. This option implies the
--nodaemon option.
This option has no effect when running ndbd or ndbmtd on Windows platforms.
| Command-Line Format | --initial | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
Instructs ndbd to perform an initial start. An initial start erases any files created for recovery purposes by earlier instances of ndbd. It also re-creates recovery log files. Note that on some operating systems this process can take a substantial amount of time.
An --initial start is to be
used only when starting the
ndbd process under very special
circumstances; this is because this option causes all files
to be removed from the NDB Cluster file system and all redo
log files to be re-created. These circumstances are listed
here:
When performing a software upgrade which has changed the contents of any files.
When restarting the node with a new version of ndbd.
As a measure of last resort when for some reason the node restart or system restart repeatedly fails. In this case, be aware that this node can no longer be used to restore data due to the destruction of the data files.
To avoid the possibility of eventual data loss, it is
recommended that you not use the
--initial option together with
StopOnError = 0. Instead, set
StopOnError to 0 in
config.ini only after the cluster has
been started, then restart the data nodes
normally—that is, without the
--initial option. See the description of
the StopOnError
parameter for a detailed explanation of this issue. (Bug
#24945638)
Use of this option prevents the
StartPartialTimeout
and
StartPartitionedTimeout
configuration parameters from having any effect.
This option does not affect either of the following types of files:
Backup files that have already been created by the affected node
NDB Cluster Disk Data files (see Section 7.12, “NDB Cluster Disk Data Tables”).
This option also has no effect on recovery of data by a data node that is just starting (or restarting) from data nodes that are already running. This recovery of data occurs automatically, and requires no user intervention in an NDB Cluster that is running normally.
It is permissible to use this option when starting the cluster for the very first time (that is, before any data node files have been created); however, it is not necessary to do so.
| Command-Line Format | --initial-start | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
This option is used when performing a partial initial start
of the cluster. Each node should be started with this
option, as well as
--nowait-nodes.
Suppose that you have a 4-node cluster whose data nodes have the IDs 2, 3, 4, and 5, and you wish to perform a partial initial start using only nodes 2, 4, and 5—that is, omitting node 3:
shell>ndbd --ndb-nodeid=2 --nowait-nodes=3 --initial-startshell>ndbd --ndb-nodeid=4 --nowait-nodes=3 --initial-startshell>ndbd --ndb-nodeid=5 --nowait-nodes=3 --initial-start
When using this option, you must also specify the node ID
for the data node being started with the
--ndb-nodeid option.
Do not confuse this option with the
--nowait-nodes option for
ndb_mgmd, which can be used to enable a
cluster configured with multiple management servers to be
started without all management servers being online.
--nowait-nodes=
node_id_1[,
node_id_2[, ...]]
| Command-Line Format | --nowait-nodes=list | ||
| Permitted Values | Type | string | |
| Default | | ||
This option takes a list of data nodes which for which the cluster will not wait for before starting.
This can be used to start the cluster in a partitioned
state. For example, to start the cluster with only half of
the data nodes (nodes 2, 3, 4, and 5) running in a 4-node
cluster, you can start each ndbd process
with --nowait-nodes=3,5. In this case, the
cluster starts as soon as nodes 2 and 4 connect, and does
not wait
StartPartitionedTimeout
milliseconds for nodes 3 and 5 to connect as it would
otherwise.
If you wanted to start up the same cluster as in the
previous example without one ndbd (say,
for example, that the host machine for node 3 has suffered a
hardware failure) then start nodes 2, 4, and 5 with
--nowait-nodes=3. Then the cluster will
start as soon as nodes 2, 4, and 5 connect and will not wait
for node 3 to start.
| Command-Line Format | --nostart | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
Instructs ndbd not to start
automatically. When this option is used,
ndbd connects to the management server,
obtains configuration data from it, and initializes
communication objects. However, it does not actually start
the execution engine until specifically requested to do so
by the management server. This can be accomplished by
issuing the proper START
command in the management client (see
Section 7.2, “Commands in the NDB Cluster Management Client”).
| Command-Line Format | --install[=name] | ||
| Platform Specific | Windows | ||
| Permitted Values | Type | string | |
| Default | ndbd | ||
Causes ndbd to be installed as a Windows
service. Optionally, you can specify a name for the service;
if not set, the service name defaults to
ndbd. Although it is preferable to
specify other ndbd program options in a
my.ini or my.cnf
configuration file, it is possible to use together with
--install. However, in such cases, the
--install option must be specified first,
before any other options are given, for the Windows service
installation to succeed.
It is generally not advisable to use this option together
with the --initial option,
since this causes the data node file system to be wiped and
rebuilt every time the service is stopped and started.
Extreme care should also be taken if you intend to use any
of the other ndbd options that affect the
starting of data nodes—including
--initial-start,
--nostart, and
--nowait-nodes—together
with --install, and you should
make absolutely certain you fully understand and allow for
any possible consequences of doing so.
The --install option has no
effect on non-Windows platforms.
| Command-Line Format | --remove[=name] | ||
| Platform Specific | Windows | ||
| Permitted Values | Type | string | |
| Default | ndbd | ||
Causes an ndbd process that was
previously installed as a Windows service to be removed.
Optionally, you can specify a name for the service to be
uninstalled; if not set, the service name defaults to
ndbd.
The --remove option has no
effect on non-Windows platforms.
| Introduced | 5.5.28-ndb-7.2.9 | ||
| Command-Line Format | --connect-retries=# | ||
| Permitted Values | Type | numeric | |
| Default | 12 | ||
| Min Value | 0 | ||
| Max Value | 65535 | ||
Determines the number of times that the data node attempts
to contact a management server when starting. Setting this
option to -1 causes the data node to keep trying to make
contact indefinitely. The default is 12 attempts. The time
to wait between attempts is controlled by the
--connect-delay option.
This option was added in NDB 7.2.9.
| Introduced | 5.5.28-ndb-7.2.9 | ||
| Command-Line Format | --connect-delay=# | ||
| Permitted Values | Type | numeric | |
| Default | 5 | ||
| Min Value | 0 | ||
| Max Value | 3600 | ||
Determines the time to wait between attempts to contact a
management server when starting (the time between attempts
is controlled by the
--connect-retries option). The
default is 5 attempts.
This option was added in NDB 7.2.9.
ndbd generates a set of log files which are
placed in the directory specified by
DataDir in the
config.ini configuration file.
These log files are listed below.
node_id is the node's unique
identifier. Note that node_id
represents the node's unique identifier. For example,
ndb_2_error.log is the error log generated
by the data node whose node ID is 2.
ndb_
is a file containing records of all crashes which the
referenced ndbd process has encountered.
Each record in this file contains a brief error string and a
reference to a trace file for this crash. A typical entry in
this file might appear as shown here:
node_id_error.log
Date/Time: Saturday 30 July 2004 - 00:20:01 Type of error: error Message: Internal program error (failed ndbrequire) Fault ID: 2341 Problem data: DbtupFixAlloc.cpp Object of reference: DBTUP (Line: 173) ProgramName: NDB Kernel ProcessID: 14909 TraceFile: ndb_2_trace.log.2 ***EOM***
Listings of possible ndbd exit codes and messages generated when a data node process shuts down prematurely can be found in Data Node Error Messages.
The last entry in the error log file is not
necessarily the newest one (nor is it likely to
be). Entries in the error log are not
listed in chronological order; rather, they correspond to
the order of the trace files as determined in the
ndb_
file (see below). Error log entries are thus overwritten
in a cyclical and not sequential fashion.
node_id_trace.log.next
ndb_
is a trace file describing exactly what happened just before
the error occurred. This information is useful for analysis
by the NDB Cluster development team.
node_id_trace.log.trace_id
It is possible to configure the number of these trace files
that will be created before old files are overwritten.
trace_id is a number which is
incremented for each successive trace file.
ndb_
is the file that keeps track of the next trace file number
to be assigned.
node_id_trace.log.next
ndb_
is a file containing any data output by the
ndbd process. This file is created only
if ndbd is started as a daemon, which is
the default behavior.
node_id_out.log
ndb_
is a file containing the process ID of the
ndbd process when started as a daemon. It
also functions as a lock file to avoid the starting of nodes
with the same identifier.
node_id.pid
ndb_
is a file used only in debug versions of
ndbd, where it is possible to trace all
incoming, outgoing, and internal messages with their data in
the ndbd process.
node_id_signal.log
It is recommended not to use a directory mounted through NFS
because in some environments this can cause problems whereby the
lock on the .pid file remains in effect
even after the process has terminated.
To start ndbd, it may also be necessary to specify the host name of the management server and the port on which it is listening. Optionally, one may also specify the node ID that the process is to use.
shell> ndbd --connect-string="nodeid=2;host=ndb_mgmd.mysql.com:1186"
See Section 5.3.3, “NDB Cluster Connection Strings”, for additional information about this issue. Section 6.26, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”, describes other command-line options which can be used with ndbd. For information about data node configuration parameters, see Section 5.3.6, “Defining NDB Cluster Data Nodes”.
When ndbd starts, it actually initiates two processes. The first of these is called the “angel process”; its only job is to discover when the execution process has been completed, and then to restart the ndbd process if it is configured to do so. Thus, if you attempt to kill ndbd using the Unix kill command, it is necessary to kill both processes, beginning with the angel process. The preferred method of terminating an ndbd process is to use the management client and stop the process from there.
The execution process uses one thread for reading, writing, and scanning data, as well as all other activities. This thread is implemented asynchronously so that it can easily handle thousands of concurrent actions. In addition, a watch-dog thread supervises the execution thread to make sure that it does not hang in an endless loop. A pool of threads handles file I/O, with each thread able to handle one open file. Threads can also be used for transporter connections by the transporters in the ndbd process. In a multi-processor system performing a large number of operations (including updates), the ndbd process can consume up to 2 CPUs if permitted to do so.
For a machine with many CPUs it is possible to use several ndbd processes which belong to different node groups; however, such a configuration is still considered experimental and is not supported for MySQL 5.5 in a production setting. See Section 3.6, “Known Limitations of NDB Cluster”.
ndbinfo_select_all is a client program that
selects all rows and columns from one or more tables in the
ndbinfo database. It is
included with the NDB Cluster distribution beginning with NDB
7.2.2.
Not all ndbinfo tables available in the
mysql client can be read by this program. In
addition, ndbinfo_select_all can show
information about some tables internal to
ndbinfo which cannot be accessed using SQL,
including the tables and
columns metadata tables.
To select from one or more ndbinfo tables
using ndbinfo_select_all, it is necessary to
supply the names of the tables when invoking the program as
shown here:
shell> ndbinfo_select_all table_name1 [table_name2] [...]
For example:
shell> ndbinfo_select_all logbuffers logspaces
== logbuffers ==
node_id log_type log_id log_part total used high
5 0 0 0 33554432 262144 0
6 0 0 0 33554432 262144 0
7 0 0 0 33554432 262144 0
8 0 0 0 33554432 262144 0
== logspaces ==
node_id log_type log_id log_part total used high
5 0 0 0 268435456 0 0
5 0 0 1 268435456 0 0
5 0 0 2 268435456 0 0
5 0 0 3 268435456 0 0
6 0 0 0 268435456 0 0
6 0 0 1 268435456 0 0
6 0 0 2 268435456 0 0
6 0 0 3 268435456 0 0
7 0 0 0 268435456 0 0
7 0 0 1 268435456 0 0
7 0 0 2 268435456 0 0
7 0 0 3 268435456 0 0
8 0 0 0 268435456 0 0
8 0 0 1 268435456 0 0
8 0 0 2 268435456 0 0
8 0 0 3 268435456 0 0
shell>
The following table includes options that are specific to ndbinfo_select_all. Additional descriptions follow the table. For options common to most NDB Cluster programs (including ndbinfo_select_all), see Section 6.26, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.
Table 6.2 This table describes command-line options for the ndbinfo_select_all program
| Format | Description | Added or Removed |
|---|---|---|
| Set the delay in seconds between loops. Default is 5. | All MySQL 5.5 based releases |
|
| Set the number of times to perform the select. Default is 1. | All MySQL 5.5 based releases |
|
| Name of the database where the table located. | All MySQL 5.5 based releases |
|
| Set the degree of parallelism. | All MySQL 5.5 based releases |
| Command-Line Format | --delay=# | ||
| Permitted Values | Type | numeric | |
| Default | 5 | ||
| Min Value | 0 | ||
| Max Value | MAX_INT | ||
This option sets the number of seconds to wait between
executing loops. Has no effect if
--loops is set to
0 or 1.
| Command-Line Format | --loops=# | ||
| Permitted Values | Type | numeric | |
| Default | 1 | ||
| Min Value | 0 | ||
| Max Value | MAX_INT | ||
This option sets the number of times to execute the select.
Use --delay to
set the time between loops.
ndbmtd is a multi-threaded version of
ndbd, the process that is used to handle all
the data in tables using the
NDBCLUSTER storage engine.
ndbmtd is intended for use on host computers
having multiple CPU cores. Except where otherwise noted,
ndbmtd functions in the same way as
ndbd; therefore, in this section, we
concentrate on the ways in which ndbmtd
differs from ndbd, and you should consult
Section 6.1, “ndbd — The NDB Cluster Data Node Daemon”, for additional
information about running NDB Cluster data nodes that apply to
both the single-threaded and multi-threaded versions of the data
node process.
Command-line options and configuration parameters used with ndbd also apply to ndbmtd. For more information about these options and parameters, see Section 6.1, “ndbd — The NDB Cluster Data Node Daemon”, and Section 5.3.6, “Defining NDB Cluster Data Nodes”, respectively.
ndbmtd is also file system-compatible with
ndbd. In other words, a data node running
ndbd can be stopped, the binary replaced with
ndbmtd, and then restarted without any loss
of data. (However, when doing this, you must make sure that
MaxNoOfExecutionThreads
is set to an apppriate value before restarting the node if you
wish for ndbmtd to run in multi-threaded
fashion.) Similarly, an ndbmtd binary can be
replaced with ndbd simply by stopping the
node and then starting ndbd in place of the
multi-threaded binary. It is not necessary when switching
between the two to start the data node binary using
--initial.
Using ndbmtd differs from using ndbd in two key respects:
Because ndbmtd runs by default in
single-threaded mode (that is, it behaves like
ndbd), you must configure it to use
multiple threads. This can be done by setting an appropriate
value in the config.ini file for the
MaxNoOfExecutionThreads
configuration parameter or (in NDB 7.2.3 and later) the
ThreadConfig
configuration parameter. Using
MaxNoOfExecutionThreads is simpler, but
ThreadConfig offers more flexibility. For
more information about these configuration parameters and
their use, see
Multi-Threading Configuration Parameters (ndbmtd).
Trace files are generated by critical errors in ndbmtd processes in a somewhat different fashion from how these are generated by ndbd failures. These differences are discussed in more detail in the next few paragraphs.
Like ndbd, ndbmtd
generates a set of log files which are placed in the directory
specified by DataDir in
the config.ini configuration file. Except
for trace files, these are generated in the same way and have
the same names as those generated by ndbd.
In the event of a critical error, ndbmtd
generates trace files describing what happened just prior to the
error' occurrence. These files, which can be found in the
data node's
DataDir, are useful for
analysis of problems by the NDB Cluster Development and Support
teams. One trace file is generated for each
ndbmtd thread. The names of these files have
the following pattern:
ndb_node_id_trace.log.trace_id_tthread_id,
In this pattern, node_id stands for
the data node's unique node ID in the cluster,
trace_id is a trace sequence number,
and thread_id is the thread ID. For
example, in the event of the failure of an
ndbmtd process running as an NDB Cluster data
node having the node ID 3 and with
MaxNoOfExecutionThreads
equal to 4, four trace files are generated in the data
node's data directory. If the is the first time this node
has failed, then these files are named
ndb_3_trace.log.1_t1,
ndb_3_trace.log.1_t2,
ndb_3_trace.log.1_t3, and
ndb_3_trace.log.1_t4. Internally, these
trace files follow the same format as ndbd
trace files.
The ndbd exit codes and messages that are generated when a data node process shuts down prematurely are also used by ndbmtd. See Data Node Error Messages, for a listing of these.
The management server is the process that reads the cluster configuration file and distributes this information to all nodes in the cluster that request it. It also maintains a log of cluster activities. Management clients can connect to the management server and check the cluster's status.
The following table includes options that are specific to the NDB Cluster management server program ndb_mgmd. Additional descriptions follow the table. For options common to most NDB Cluster programs (including ndb_mgmd), see Section 6.26, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.
Table 6.3 This table describes command-line options for the ndb_mgmd program
| Format | Description | Added or Removed |
|---|---|---|
| Specify the cluster configuration file; in NDB-6.4.0 and later, needs --reload or --initial to override configuration cache if present | All MySQL 5.5 based releases |
|
| Specify the cluster management server's configuration cache directory | All MySQL 5.5 based releases |
|
| Local bind address | All MySQL 5.5 based releases |
|
| Print full configuration and exit | All MySQL 5.5 based releases |
|
| Run ndb_mgmd in daemon mode (default) | All MySQL 5.5 based releases |
|
| Do not run ndb_mgmd as a daemon | All MySQL 5.5 based releases |
|
| Run ndb_mgmd in interactive mode (not officially supported in production; for testing purposes only) | All MySQL 5.5 based releases |
|
| A name to use when writing messages applying to this node in the cluster log. | All MySQL 5.5 based releases |
|
| Do not provide any node id checks | All MySQL 5.5 based releases |
|
| Read cluster configuration data from the my.cnf file | All MySQL 5.5 based releases |
|
| Causes the management server to compare the configuration file with its configuration cache | All MySQL 5.5 based releases |
|
| Causes the management server reload its configuration data from the configuration file, bypassing the configuration cache | All MySQL 5.5 based releases |
|
| Do not wait for these management nodes when starting this management server. Also requires --ndb-nodeid to be used. | All MySQL 5.5 based releases |
|
| Enable the management server configuration cache; TRUE by default. | All MySQL 5.5 based releases |
|
| Used to install the management server process as a Windows service. Does not apply on non-Windows platforms. | All MySQL 5.5 based releases |
|
| Used to remove a management server process that was previously installed as a Windows service, optionally specifying the name of the service to be removed. Does not apply on non-Windows platforms. | All MySQL 5.5 based releases |
| Command-Line Format | --bind-address=ip_address | ||
| Permitted Values | Type | string | |
| Default | [none] | ||
When specified, this option limits management server
connections by management clients to clients at the
specified host name or IP address (and possibly port, if
this is also specified). In such cases, a management client
attempting to connect to the management server from any
other address fails with the error Unable to
setup port:
host:port!
If the port is not specified, the
management client attempts to use port 1186.
| Command-Line Format | --no-nodeid-checks | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
Do not perform any checks of node IDs.
| Command-Line Format | --configdir=directory | ||
--config-dir=directory | |||
| Permitted Values | Type | file name | |
| Default | $INSTALLDIR/mysql-cluster | ||
Specifies the cluster management server's configuration
cache directory. --config-dir is an alias
for this option.
| Command-Line Format | --config-cache[=TRUE|FALSE] | ||
| Permitted Values | Type | boolean | |
| Default | TRUE | ||
This option, whose default value is 1 (or
TRUE, or ON), can be
used to disable the management server's configuration
cache, so that it reads its configuration from
config.ini every time it starts (see
Section 5.3, “NDB Cluster Configuration Files”). You can do
this by starting the ndb_mgmd process
with any one of the following options:
Using one of the options just listed is effective only if
the management server has no stored configuration at the
time it is started. If the management server finds any
configuration cache files, then the
--config-cache option or the
--skip-config-cache option is ignored.
Therefore, to disable configuration caching, the option
should be used the first time that the
management server is started. Otherwise—that is, if
you wish to disable configuration caching for a management
server that has already created a
configuration cache—you must stop the management
server, delete any existing configuration cache files
manually, then restart the management server with
--skip-config-cache (or with
--config-cache set equal to 0,
OFF, or FALSE).
Configuration cache files are normally created in a
directory named mysql-cluster under the
installation directory (unless this location has been
overridden using the
--configdir option). Each
time the management server updates its configuration data,
it writes a new cache file. The files are named sequentially
in order of creation using the following format:
ndb_node-id_config.bin.seq-number
node-id is the management
server's node ID; seq-number
is a sequence number, beginning with 1. For example, if the
management server's node ID is 5, then the first three
configuration cache files would, when they are created, be
named ndb_5_config.bin.1,
ndb_5_config.bin.2, and
ndb_5_config.bin.3.
If your intent is to purge or reload the configuration cache
without actually disabling caching, you should start
ndb_mgmd with one of the options
--reload or
--initial instead of
--skip-config-cache.
To re-enable the configuration cache, simply restart the
management server, but without the
--config-cache or
--skip-config-cache option that was used
previously to disable the configuration cache.
Beginning with NDB 7.2.5, ndb_mgmd no
longer checks for the configuration directory
(--configdir) or attempts
to create one when --skip-config-cache is
used. (Bug #13428853)
--config-file=,
filename-f
filename
| Command-Line Format | --config-file=file | ||
| Permitted Values | Type | file name | |
| Default | [none] | ||
Instructs the management server as to which file it should
use for its configuration file. By default, the management
server looks for a file named
config.ini in the same directory as the
ndb_mgmd executable; otherwise the file
name and location must be specified explicitly.
This option has no default value, and is ignored unless the
management server is forced to read the configuration file,
either because ndb_mgmd was started with
the --reload or
--initial option, or
because the management server could not find any
configuration cache. This option is also read if
ndb_mgmd was started with
--config-cache=OFF. See
Section 5.3, “NDB Cluster Configuration Files”, for more
information.
Formerly, using this option together with
--initial caused removal of
the configuration cache even if the file was not found. This
issue was resolved in NDB 7.2.13. (Bug #1299289)
| Command-Line Format | --mycnf | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
Read configuration data from the my.cnf
file.
| Command-Line Format | --daemon | ||
| Permitted Values | Type | boolean | |
| Default | TRUE | ||
Instructs ndb_mgmd to start as a daemon process. This is the default behavior.
This option has no effect when running ndb_mgmd on Windows platforms.
| Command-Line Format | --interactive | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
Starts ndb_mgmd in interactive mode; that is, an ndb_mgm client session is started as soon as the management server is running. This option does not start any other NDB Cluster nodes.
| Command-Line Format | --initial | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
Configuration data is cached internally, rather than being
read from the cluster global configuration file each time
the management server is started (see
Section 5.3, “NDB Cluster Configuration Files”). Using the
--initial option overrides this behavior,
by forcing the management server to delete any existing
cache files, and then to re-read the configuration data from
the cluster configuration file and to build a new cache.
This differs in two ways from the
--reload option. First,
--reload forces the server to check the
configuration file against the cache and reload its data
only if the contents of the file are different from the
cache. Second, --reload does not delete any
existing cache files.
If ndb_mgmd is invoked with
--initial but cannot find a global
configuration file, the management server cannot start.
When a management server starts, it checks for another
management server in the same NDB Cluster and tries to use
the other management server's configuration data;
ndb_mgmd ignores
--initial unless it is the
only management server running. This behavior also has
implications when performing a rolling restart of an NDB
Cluster with multiple management nodes. See
Section 7.5, “Performing a Rolling Restart of an NDB Cluster”, for more
information.
Formerly, using this option together with the
--config-file option caused
removal of the configuration cache even if the file was not
found. Starting with NDB 7.2.13, the cache is cleared in
such cases only if the configuration file is actually found.
(Bug #1299289)
| Command-Line Format | --log-name=name | ||
| Permitted Values | Type | string | |
| Default | MgmtSrvr | ||
Provides a name to be used for this node in the cluster log.
| Command-Line Format | --nodaemon | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
Instructs ndb_mgmd not to start as a daemon process.
The default behavior for ndb_mgmd on Windows is to run in the foreground, making this option unnecessary on Windows platforms.
| Command-Line Format | --print-full-config | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
Shows extended information regarding the configuration of
the cluster. With this option on the command line the
ndb_mgmd process prints information about
the cluster setup including an extensive list of the cluster
configuration sections as well as parameters and their
values. Normally used together with the
--config-file
(-f) option.
| Command-Line Format | --reload | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
In NDB Cluster 7.2, configuration data is stored internally rather than being read from the cluster global configuration file each time the management server is started (see Section 5.3, “NDB Cluster Configuration Files”). Using this option forces the management server to check its internal data store against the cluster configuration file and to reload the configuration if it finds that the configuration file does not match the cache. Existing configuration cache files are preserved, but not used.
This differs in two ways from the
--initial option. First,
--initial causes all cache files to be
deleted. Second, --initial forces the
management server to re-read the global configuration file
and construct a new cache.
If the management server cannot find a global configuration
file, then the --reload option is ignored.
When a management server starts, it checks for another
management server in the same NDB Cluster and tries to use
the other management server's configuration data;
ndb_mgmd ignores
--reload unless it is the
only management server running. This behavior also has
implications when performing a rolling restart of an NDB
Cluster with multiple management nodes. See
Section 7.5, “Performing a Rolling Restart of an NDB Cluster”, for more
information.
| Command-Line Format | --nowait-nodes=list | ||
| Permitted Values | Type | numeric | |
| Default | | ||
| Min Value | 1 | ||
| Max Value | 255 | ||
When starting an NDB Cluster is configured with two management nodes, each management server normally checks to see whether the other ndb_mgmd is also operational and whether the other management server's configuration is identical to its own. However, it is sometimes desirable to start the cluster with only one management node (and perhaps to allow the other ndb_mgmd to be started later). This option causes the management node to bypass any checks for any other management nodes whose node IDs are passed to this option, permitting the cluster to start as though configured to use only the management node that was started.
For purposes of illustration, consider the following portion
of a config.ini file (where we have
omitted most of the configuration parameters that are not
relevant to this example):
[ndbd] NodeId = 1 HostName = 192.168.0.101 [ndbd] NodeId = 2 HostName = 192.168.0.102 [ndbd] NodeId = 3 HostName = 192.168.0.103 [ndbd] NodeId = 4 HostName = 192.168.0.104 [ndb_mgmd] NodeId = 10 HostName = 192.168.0.150 [ndb_mgmd] NodeId = 11 HostName = 192.168.0.151 [api] NodeId = 20 HostName = 192.168.0.200 [api] NodeId = 21 HostName = 192.168.0.201
Assume that you wish to start this cluster using only the
management server having node ID 10 and
running on the host having the IP address 192.168.0.150.
(Suppose, for example, that the host computer on which you
intend to the other management server is temporarily
unavailable due to a hardware failure, and you are waiting
for it to be repaired.) To start the cluster in this way,
use a command line on the machine at 192.168.0.150 to enter
the following command:
shell> ndb_mgmd --ndb-nodeid=10 --nowait-nodes=11
As shown in the preceding example, when using
--nowait-nodes, you must
also use the --ndb-nodeid
option to specify the node ID of this
ndb_mgmd process.
You can then start each of the cluster's data nodes in the usual way. If you wish to start and use the second management server in addition to the first management server at a later time without restarting the data nodes, you must start each data node with a connection string that references both management servers, like this:
shell> ndbd -c 192.168.0.150,192.168.0.151
The same is true with regard to the connection string used with any mysqld processes that you wish to start as NDB Cluster SQL nodes connected to this cluster. See Section 5.3.3, “NDB Cluster Connection Strings”, for more information.
When used with ndb_mgmd, this option
affects the behavior of the management node with regard to
other management nodes only. Do not confuse it with the
--nowait-nodes option used with
ndbd or ndbmtd to
permit a cluster to start with fewer than its full
complement of data nodes; when used with data nodes, this
option affects their behavior only with regard to other data
nodes.
Multiple management node IDs may be passed to this option as a comma-separated list. Each node ID must be no less than 1 and no greater than 255. In practice, it is quite rare to use more than two management servers for the same NDB Cluster (or to have any need for doing so); in most cases you need to pass to this option only the single node ID for the one management server that you do not wish to use when starting the cluster.
When you later start the “missing” management server, its configuration must match that of the management server that is already in use by the cluster. Otherwise, it fails the configuration check performed by the existing management server, and does not start.
It is not strictly necessary to specify a connection string when starting the management server. However, if you are using more than one management server, a connection string should be provided and each node in the cluster should specify its node ID explicitly.
See Section 5.3.3, “NDB Cluster Connection Strings”, for information about using connection strings. Section 6.4, “ndb_mgmd — The NDB Cluster Management Server Daemon”, describes other options for ndb_mgmd.
The following files are created or used by
ndb_mgmd in its starting directory, and are
placed in the DataDir as
specified in the config.ini configuration
file. In the list that follows,
node_id is the unique node
identifier.
config.ini is the configuration file
for the cluster as a whole. This file is created by the user
and read by the management server.
Chapter 5, Configuration of NDB Cluster, discusses how
to set up this file.
ndb_
is the cluster events log file. Examples of such events
include checkpoint startup and completion, node startup
events, node failures, and levels of memory usage. A
complete listing of cluster events with descriptions may be
found in Chapter 7, Management of NDB Cluster.
node_id_cluster.log
By default, when the size of the cluster log reaches one
million bytes, the file is renamed to
ndb_,
where node_id_cluster.log.seq_idseq_id is the sequence
number of the cluster log file. (For example: If files with
the sequence numbers 1, 2, and 3 already exist, the next log
file is named using the number 4.) You
can change the size and number of files, and other
characteristics of the cluster log, using the
LogDestination
configuration parameter.
ndb_
is the file used for node_id_out.logstdout and
stderr when running the management server
as a daemon.
ndb_
is the process ID file used when running the management
server as a daemon.
node_id.pid
| Command-Line Format | --install[=name] | ||
| Platform Specific | Windows | ||
| Permitted Values | Type | string | |
| Default | ndb_mgmd | ||
Causes ndb_mgmd to be installed as a
Windows service. Optionally, you can specify a name for the
service; if not set, the service name defaults to
ndb_mgmd. Although it is preferable to
specify other ndb_mgmd program options in
a my.ini or my.cnf
configuration file, it is possible to use them together with
--install. However, in such
cases, the --install option
must be specified first, before any other options are given,
for the Windows service installation to succeed.
It is generally not advisable to use this option together
with the --initial option,
since this causes the configuration cache to be wiped and
rebuilt every time the service is stopped and started. Care
should also be taken if you intend to use any other
ndb_mgmd options that affect the starting
of the management server, and you should make absolutely
certain you fully understand and allow for any possible
consequences of doing so.
The --install option has no
effect on non-Windows platforms.
| Command-Line Format | --remove[=name] | ||
| Platform Specific | Windows | ||
| Permitted Values | Type | string | |
| Default | ndb_mgmd | ||
Causes an ndb_mgmd process that was
previously installed as a Windows service to be removed.
Optionally, you can specify a name for the service to be
uninstalled; if not set, the service name defaults to
ndb_mgmd.
The --remove option has no
effect on non-Windows platforms.
The ndb_mgm management client process is actually not needed to run the cluster. Its value lies in providing a set of commands for checking the cluster's status, starting backups, and performing other administrative functions. The management client accesses the management server using a C API. Advanced users can also employ this API for programming dedicated management processes to perform tasks similar to those performed by ndb_mgm.
To start the management client, it is necessary to supply the host name and port number of the management server:
shell> ndb_mgm [host_name [port_num]]
For example:
shell> ndb_mgm ndb_mgmd.mysql.com 1186
The default host name and port number are
localhost and 1186, respectively.
The following table includes options that are specific to the NDB Cluster management client program ndb_mgm. Additional descriptions follow the table. For options common to most NDB Cluster programs (including ndb_mgm), see Section 6.26, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.
Table 6.4 This table describes command-line options for the ndb_mgm program
| Format | Description | Added or Removed |
|---|---|---|
| Set the number of times to retry a connection before giving up; synonym for --connect-retries | All MySQL 5.5 based releases |
|
| Execute command and exit | All MySQL 5.5 based releases |
| Command-Line Format | --execute=name | ||
This option can be used to send a command to the NDB Cluster
management client from the system shell. For example, either
of the following is equivalent to executing
SHOW in the management
client:
shell>ndb_mgm -e "SHOW"shell>ndb_mgm --execute="SHOW"
This is analogous to how the
--execute or
-e option works with the
mysql command-line client. See
Using Options on the Command Line.
If the management client command to be passed using this option contains any space characters, then the command must be enclosed in quotation marks. Either single or double quotation marks may be used. If the management client command contains no space characters, the quotation marks are optional.
| Command-Line Format | --try-reconnect=# | ||
| Permitted Values | Type | integer | |
| Default | 3 | ||
| Min Value | 0 | ||
| Max Value | 4294967295 | ||
If the connection to the management server is broken, the
node tries to reconnect to it every 5 seconds until it
succeeds. By using this option, it is possible to limit the
number of attempts to number
before giving up and reporting an error instead.
Additional information about using ndb_mgm can be found in Section 7.2, “Commands in the NDB Cluster Management Client”.
This tool can be used to check for and remove orphaned BLOB
column parts from NDB tables, as
well as to generate a file listing any orphaned parts. It is
sometimes useful in diagnosing and repairing corrupted or
damaged NDB tables containing
BLOB or
TEXT columns.
The basic syntax for ndb_blob_tool is shown here:
ndb_blob_tool [options]table[column, ...]
Unless you use the --help
option, you must specify an action to be performed by including
one or more of the options
--check-orphans,
--delete-orphans, or
--dump-file. These options
cause ndb_blob_tool to check for orphaned
BLOB parts, remove any orphaned BLOB parts, and generate a dump
file listing orphaned BLOB parts, respectively, and are
described in more detail later in this section.
You must also specify the name of a table when invoking
ndb_blob_tool. In addition, you can
optionally follow the table name with the (comma-separated)
names of one or more BLOB or
TEXT columns from that table. If
no columns are listed, the tool works on all of the table's
BLOB and
TEXT columns. If you need to
specify a database, use the
--database
(-d) option.
The --verbose option
provides additional information in the output about the
tool's progress.
The following table includes options that are specific to ndb_blob_tool. Additional descriptions follow the table. For options common to most NDB Cluster programs (including ndb_blob_tool), see Section 6.26, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.
Table 6.5 This table describes command-line options for the ndb_blob_tool program
| Format | Description | Added or Removed |
|---|---|---|
| Check for orphan blob parts | All MySQL 5.5 based releases |
|
| Database to find the table in. | All MySQL 5.5 based releases |
|
| Delete orphan blob parts | All MySQL 5.5 based releases |
|
| Write orphan keys to specified file | All MySQL 5.5 based releases |
|
| Verbose output | All MySQL 5.5 based releases |
| Command-Line Format | --check-orphans | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
Check for orphaned BLOB parts in NDB Cluster tables.
| Command-Line Format | --database=db_name | ||
| Permitted Values | Type | string | |
| Default | [none] | ||
Specify the database to find the table in.
| Command-Line Format | --delete-orphans | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
Remove orphaned BLOB parts from NDB Cluster tables.
| Command-Line Format | --dump-file=file | ||
| Permitted Values | Type | file name | |
| Default | [none] | ||
Writes a list of orphaned BLOB column parts to
file. The information written to
the file includes the table key and BLOB part number for
each orphaned BLOB part.
| Command-Line Format | --verbose | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
Provide extra information in the tool's output regarding its progress.
First we create an NDB table in the
test database, using the
CREATE TABLE statement shown
here:
USE test;
CREATE TABLE btest (
c0 BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
c1 TEXT,
c2 BLOB
) ENGINE=NDB;
Then we insert a few rows into this table, using a series of statements similar to this one:
INSERT INTO btest VALUES (NULL, 'x', REPEAT('x', 1000));
When run with
--check-orphans against
this table, ndb_blob_tool generates the
following output:
shell> ndb_blob_tool --check-orphans --verbose -d test btest
connected
processing 2 blobs
processing blob #0 c1 NDB$BLOB_19_1
NDB$BLOB_19_1: nextResult: res=1
total parts: 0
orphan parts: 0
processing blob #1 c2 NDB$BLOB_19_2
NDB$BLOB_19_2: nextResult: res=0
NDB$BLOB_19_2: nextResult: res=0
NDB$BLOB_19_2: nextResult: res=0
NDB$BLOB_19_2: nextResult: res=0
NDB$BLOB_19_2: nextResult: res=0
NDB$BLOB_19_2: nextResult: res=0
NDB$BLOB_19_2: nextResult: res=0
NDB$BLOB_19_2: nextResult: res=0
NDB$BLOB_19_2: nextResult: res=0
NDB$BLOB_19_2: nextResult: res=0
NDB$BLOB_19_2: nextResult: res=1
total parts: 10
orphan parts: 0
disconnected
NDBT_ProgramExit: 0 - OK
The tool reports that there are no NDB BLOB
column parts associated with column c1, even
though c1 is a
TEXT column. This is due to the
fact that, in an NDB table, only
the first 256 bytes of a BLOB or
TEXT column value are stored
inline, and only the excess, if any, is stored separately; thus,
if there are no values using more than 256 bytes in a given
column of one of these types, no BLOB column
parts are created by NDB for this column. See
Data Type Storage Requirements, for more information.
This tool extracts current configuration information for data
nodes, SQL nodes, and API nodes from one of a number of sources:
an NDB Cluster management node, or its
config.ini or my.cnf
file. By default, the management node is the source for the
configuration data; to override the default, execute ndb_config
with the --config-file or
--mycnf option. It is also
possible to use a data node as the source by specifying its node
ID with
--config_from_node=.
node_id
ndb_config can also provide an offline dump
of all configuration parameters which can be used, along with
their default, maximum, and minimum values and other
information. The dump can be produced in either text or XML
format; for more information, see the discussion of the
--configinfo and
--xml options later in this
section).
You can filter the results by section (DB,
SYSTEM, or CONNECTIONS)
using one of the options
--nodes,
--system, or
--connections.
The following table includes options that are specific to ndb_config. Additional descriptions follow the table. For options common to most NDB Cluster programs (including ndb_config), see Section 6.26, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.
Table 6.6 This table describes command-line options for the ndb_config program
| Format | Description | Added or Removed |
|---|---|---|
| Print node information ([ndbd] or [ndbd default] section of cluster configuration file) only. Cannot be used with --system or --connections. | All MySQL 5.5 based releases |
|
| Print connections information ([tcp], [tcp default], [sci], [sci default], [shm], or [shm default] sections of cluster configuration file) only. Cannot be used with --system or --nodes. | All MySQL 5.5 based releases |
|
| One or more query options (attributes) | All MySQL 5.5 based releases |
|
| Specify host | All MySQL 5.5 based releases |
|
| Specify node type | All MySQL 5.5 based releases |
|
| Get configuration of node with this ID | All MySQL 5.5 based releases |
|
| Field separator | All MySQL 5.5 based releases |
|
| Row separator | All MySQL 5.5 based releases |
|
| Set the path to config.ini file | All MySQL 5.5 based releases |
|
| Read configuration data from my.cnf file | All MySQL 5.5 based releases |
|
| Short form for --ndb-connectstring | All MySQL 5.5 based releases |
|
| Dumps information about all NDB configuration parameters in text format with default, maximum, and minimum values. Use with --xml to obtain XML output. | All MySQL 5.5 based releases |
|
| Use --xml with --configinfo to obtain a dump of all NDB configuration parameters in XML format with default, maximum, and minimum values. | All MySQL 5.5 based releases |
|
| Print SYSTEM section information only (see ndb_config --configinfo output). Cannot be used with --nodes or --connections. | All MySQL 5.5 based releases |
|
| Obtain configuration data from the node having this ID (must be a data node). | All MySQL 5.5 based releases |
| Command-Line Format | --help | ||
--usage | |||
Causes ndb_config to print a list of available options, and then exit.
| Command-Line Format | --config_from_node=# | ||
| Permitted Values | Type | numeric | |
| Default | none | ||
| Min Value | 1 | ||
| Max Value | 48 | ||
Obtain the cluster's configuration data from the data node that has this ID.
If the node having this ID is not a data node, ndb_config fails with an error. (To obtain configuration data from the management node instead, simply omit this option.)
| Command-Line Format | --version | ||
Causes ndb_config to print a version information string, and then exit.
--ndb-connectstring=,
connection_string-c
connection_string
| Command-Line Format | --ndb-connectstring=connectstring | ||
--connect-string=connectstring | |||
| Permitted Values | Type | string | |
| Default | localhost:1186 | ||
Specifies the connection string to use in connecting to the
management server. The format for the connection string is
the same as described in
Section 5.3.3, “NDB Cluster Connection Strings”, and
defaults to localhost:1186.
| Command-Line Format | --config-file=file_name | ||
| Permitted Values | Type | file name | |
| Default | | ||
Gives the path to the management server's configuration file
(config.ini). This may be a relative or
absolute path. If the management node resides on a different
host from the one on which ndb_config is
invoked, then an absolute path must be used.
| Command-Line Format | --mycnf | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
Read configuration data from the my.cnf
file.
--query=,
query-options-q query-options
| Command-Line Format | --query=string | ||
| Permitted Values | Type | string | |
| Default | | ||
This is a comma-delimited list of
query
options—that is, a list of one or more node
attributes to be returned. These include
id (node ID), type (node type—that
is, ndbd, mysqld, or
ndb_mgmd), and any configuration
parameters whose values are to be obtained.
For example,
--query=id,type,indexmemory,datamemory
returns the node ID, node type,
DataMemory, and
IndexMemory for each
node.
If a given parameter is not applicable to a certain type of node, than an empty string is returned for the corresponding value. See the examples later in this section for more information.
| Command-Line Format | --host=name | ||
| Permitted Values | Type | string | |
| Default | | ||
Specifies the host name of the node for which configuration information is to be obtained.
While the hostname localhost usually
resolves to the IP address 127.0.0.1,
this may not necessarily be true for all operating
platforms and configurations. This means that it is
possible, when localhost is used in
config.ini, for ndb_config
--host=localhost to fail if
ndb_config is run on a different host
where localhost resolves to a different
address (for example, on some versions of SUSE Linux, this
is 127.0.0.2). In general, for best
results, you should use numeric IP addresses for all NDB
Cluster configuration values relating to hosts, or verify
that all NDB Cluster hosts handle
localhost in the same fashion.
| Command-Line Format | --ndb-nodeid=# | ||
| Permitted Values | Type | numeric | |
| Default | 0 | ||
Either of these options can be used to specify the node ID
of the node for which configuration information is to be
obtained. --nodeid is the preferred form.
| Command-Line Format | --nodes | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
Tells ndb_config to print information
relating only to parameters defined in an
[ndbd] or [ndbd
default] section of the cluster configuration file
(see Section 5.3.6, “Defining NDB Cluster Data Nodes”).
This option is mutually exclusive with
--connections and
--system; only one of
these 3 options can be used.
| Command-Line Format | --connections | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
Tells ndb_config to print
CONNECTIONS information only—that
is, information about parameters found in the
[tcp], [tcp default],
[sci], [sci default],
[shm], or [shm
default] sections of the cluster configuration
file (see Section 5.3.9, “NDB Cluster TCP/IP Connections”,
Section 5.3.12, “SCI Transport Connections in NDB Cluster”, and
Section 5.3.11, “NDB Cluster Shared-Memory Connections”, for more
information).
This option is mutually exclusive with
--nodes and
--system; only one of
these 3 options can be used.
| Command-Line Format | --system | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
Tells ndb_config to print
SYSTEM information only. This consists of
system variables that cannot be changed at run time; thus,
there is no corresponding section of the cluster
configuration file for them. They can be seen (prefixed with
****** SYSTEM ******) in the output of
ndb_config
--configinfo.
This option is mutually exclusive with
--nodes and
--connections; only one
of these 3 options can be used.
| Command-Line Format | --type=name | ||
| Permitted Values | Type | enumeration | |
| Default | [none] | ||
| Valid Values | ndbd | ||
mysqld | |||
ndb_mgmd | |||
Filters results so that only configuration values applying
to nodes of the specified
node_type
(ndbd, mysqld, or
ndb_mgmd) are returned.
--fields=,
delimiter-f delimiter
| Command-Line Format | --fields=string | ||
| Permitted Values | Type | string | |
| Default | | ||
Specifies a delimiter string used
to separate the fields in the result. The default is
, (the comma character).
If the delimiter contains
spaces or escapes (such as \n for the
linefeed character), then it must be quoted.
--rows=,
separator-r separator
| Command-Line Format | --rows=string | ||
| Permitted Values | Type | string | |
| Default | | ||
Specifies a separator string used
to separate the rows in the result. The default is a space
character.
If the separator contains
spaces or escapes (such as \n for the
linefeed character), then it must be quoted.
The --configinfo option causes
ndb_config to dump a list of each NDB
Cluster configuration parameter supported by the NDB Cluster
distribution of which ndb_config is a
part, including the following information:
A brief description of each parameter's purpose, effects, and usage
The section of the config.ini file
where the parameter may be used
The parameter's data type or unit of measurement
Where applicable, the parameter's default, minimum, and maximum values
NDB Cluster release version and build information
By default, this output is in text format. Part of this output is shown here:
shell> ndb_config --configinfo
****** SYSTEM ******
Name (String)
Name of system (NDB Cluster)
MANDATORY
PrimaryMGMNode (Non-negative Integer)
Node id of Primary ndb_mgmd(MGM) node
Default: 0 (Min: 0, Max: 4294967039)
ConfigGenerationNumber (Non-negative Integer)
Configuration generation number
Default: 0 (Min: 0, Max: 4294967039)
****** DB ******
MaxNoOfSubscriptions (Non-negative Integer)
Max no of subscriptions (default 0 == MaxNoOfTables)
Default: 0 (Min: 0, Max: 4294967039)
MaxNoOfSubscribers (Non-negative Integer)
Max no of subscribers (default 0 == 2 * MaxNoOfTables)
Default: 0 (Min: 0, Max: 4294967039)
…
| Command-Line Format | --configinfo --xml | ||
| Permitted Values | Type | boolean | |
| Default | false | ||
You can obtain the output of ndb_config
--configinfo as XML by
adding the --xml option. A portion of the
resulting output is shown in this example:
shell> ndb_config --configinfo --xml
<configvariables protocolversion="1" ndbversionstring="5.5.53-ndb-7.2.27"
ndbversion="458758" ndbversionmajor="7" ndbversionminor="0"
ndbversionbuild="6">
<section name="SYSTEM">
<param name="Name" comment="Name of system (NDB Cluster)" type="string"
mandatory="true"/>
<param name="PrimaryMGMNode" comment="Node id of Primary ndb_mgmd(MGM) node"
type="unsigned" default="0" min="0" max="4294967039"/>
<param name="ConfigGenerationNumber" comment="Configuration generation number"
type="unsigned" default="0" min="0" max="4294967039"/>
</section>
<section name="NDBD">
<param name="MaxNoOfSubscriptions"
comment="Max no of subscriptions (default 0 == MaxNoOfTables)"
type="unsigned" default="0" min="0" max="4294967039"/>
<param name="MaxNoOfSubscribers"
comment="Max no of subscribers (default 0 == 2 * MaxNoOfTables)"
type="unsigned" default="0" min="0" max="4294967039"/>
…
</section>
…
</configvariables>
Normally, the XML output produced by
ndb_config
--configinfo --xml is
formatted using one line per element; we have added extra
whitespace in the previous example, as well as the next
one, for reasons of legibility. This should not make any
difference to applications using this output, since most
XML processors either ignore nonessential whitespace as a
matter of course, or can be instructed to do so.
The XML output also indicates when changing a given
parameter requires that data nodes be restarted using the
--initial option. This is shown
by the presence of an initial="true"
attribute in the corresponding
<param> element. In addition, the
restart type (system or
node) is also shown; if a given parameter
requires a system restart, this is indicated by the presence
of a restart="system" attribute in the
corresponding <param> element. For
example, changing the value set for the
Diskless parameter
requires a system initial restart, as shown here (with the
restart and initial
attributes highlighted for visibility):
<param name="Diskless" comment="Run wo/ disk" type="bool" default="false"
restart="system" initial="true"/>
Currently, no initial attribute is
included in the XML output for
<param> elements corresponding to
parameters which do not require initial restarts; in other
words, initial="false" is the default,
and the value false should be assumed if
the attribute is not present. Similarly, the default restart
type is node (that is, an online or
“rolling” restart of the cluster), but the
restart attribute is included only if the
restart type is system (meaning that all
cluster nodes must be shut down at the same time, then
restarted).
The --xml option can be used only with
the --configinfo option. Using
--xml without
--configinfo fails with an error.
Unlike the options used with this program to obtain current
configuration data, --configinfo and
--xml use information obtained from the NDB
Cluster sources when ndb_config was
compiled. For this reason, no connection to a running NDB
Cluster or access to a config.ini or
my.cnf file is required for these two
options.
Combining other ndb_config options (such
as --query or
--type) with
--configinfo or --xml is
not supported. Currently, if you attempt to do so, the usual
result is that all other options besides
--configinfo or --xml are
simply ignored. However, this behavior is not
guaranteed and is subject to change at any time.
In addition, since ndb_config, when used
with the --configinfo option, does not
access the NDB Cluster or read any files, trying to specify
additional options such as
--ndb-connectstring or
--config-file with
--configinfo serves no purpose.
To obtain the node ID and type of each node in the cluster:
shell> ./ndb_config --query=id,type --fields=':' --rows='\n'
1:ndbd
2:ndbd
3:ndbd
4:ndbd
5:ndb_mgmd
6:mysqld
7:mysqld
8:mysqld
9:mysqld
In this example, we used the
--fields options to
separate the ID and type of each node with a colon character
(:), and the
--rows options to place
the values for each node on a new line in the output.
To produce a connection string that can be used by data, SQL, and API nodes to connect to the management server:
shell> ./ndb_config --config-file=usr/local/mysql/cluster-data/config.ini \
--query=hostname,portnumber --fields=: --rows=, --type=ndb_mgmd
192.168.0.179:1186
This invocation of ndb_config checks only
data nodes (using the
--type option), and shows
the values for each node's ID and host name, as well as
the values set for its
DataMemory,
IndexMemory, and
DataDir parameters:
shell> ./ndb_config --type=ndbd --query=id,host,datamemory,indexmemory,datadir -f ' : ' -r '\n'
1 : 192.168.0.193 : 83886080 : 18874368 : /usr/local/mysql/cluster-data
2 : 192.168.0.112 : 83886080 : 18874368 : /usr/local/mysql/cluster-data
3 : 192.168.0.176 : 83886080 : 18874368 : /usr/local/mysql/cluster-data
4 : 192.168.0.119 : 83886080 : 18874368 : /usr/local/mysql/cluster-data
In this example, we used the short options
-f and -r for setting the
field delimiter and row separator, respectively.
To exclude results from any host except one in particular,
use the --host option:
shell> ./ndb_config --host=192.168.0.176 -f : -r '\n' -q id,type
3:ndbd
5:ndb_mgmd
In this example, we also used the short form
-q to determine the attributes to be
queried.
Similarly, you can limit results to a node with a specific
ID using the --id or
--nodeid option.
A utility having this name was formerly part of an internal automated test framework used in testing and debugging NDB Cluster. It was deprecated in NDB Cluster 7.0, and removed from NDB Cluster distributions provided by Oracle beginning with NDB 7.2.1.
ndb_delete_all deletes all rows from the
given NDB table. In some cases,
this can be much faster than
DELETE or even
TRUNCATE TABLE.
ndb_delete_all -cconnection_stringtbl_name-ddb_name
This deletes all rows from the table named
tbl_name in the database named
db_name. It is exactly equivalent to
executing TRUNCATE
in MySQL.
db_name.tbl_name
The following table includes options that are specific to ndb_delete_all. Additional descriptions follow the table. For options common to most NDB Cluster programs (including ndb_delete_all), see Section 6.26, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.
Table 6.7 This table describes command-line options for the ndb_delete_all program
| Format | Description | Added or Removed |
|---|---|---|
|
Name of the database in which the table is found | All MySQL 5.5 based releases |
| Perform the delete in a single transaction (may run out of operations) | All MySQL 5.5 based releases |
|
|
Run tup scan | All MySQL 5.5 based releases |
|
Run disk scan | All MySQL 5.5 based releases |
ndb_desc provides a detailed description of
one or more NDB tables.
ndb_desc -cconnection_stringtbl_name-ddb_name[options]
(NDB 7.2.9 and later:)
ndb_desc -cconnection_stringindex_name-ddb_name-ttbl_name
Additional options that can be used with ndb_desc are listed later in this section.
MySQL table creation and population statements:
USE test;
CREATE TABLE fish (
id INT(11) NOT NULL AUTO_INCREMENT,
name VARCHAR(20) NOT NULL,
length_mm INT(11) NOT NULL,
weight_gm INT(11) NOT NULL,
PRIMARY KEY pk (id),
UNIQUE KEY uk (name)
) ENGINE=NDB;
INSERT INTO fish VALUES
('','guppy', 35, 2), ('','tuna', 2500, 150000),
('','shark', 3000, 110000), ('','manta ray', 1500, 50000),
('','grouper', 900, 125000), ('','puffer', 250, 2500);
Output from ndb_desc:
shell> ./ndb_desc -c localhost fish -d test -p
-- fish --
Version: 2
Fragment type: 9
K Value: 6
Min load factor: 78
Max load factor: 80
Temporary table: no
Number of attributes: 4
Number of primary keys: 1
Length of frm data: 311
Row Checksum: 1
Row GCI: 1
SingleUserMode: 0
ForceVarPart: 1
FragmentCount: 2
TableStatus: Retrieved
-- Attributes --
id Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY AUTO_INCR
name Varchar(20;latin1_swedish_ci) NOT NULL AT=SHORT_VAR ST=MEMORY
length_mm Int NOT NULL AT=FIXED ST=MEMORY
weight_gm Int NOT NULL AT=FIXED ST=MEMORY
-- Indexes --
PRIMARY KEY(id) - UniqueHashIndex
PRIMARY(id) - OrderedIndex
uk$unique(name) - UniqueHashIndex
uk(name) - OrderedIndex
-- Per partition info --
Partition Row count Commit count Frag fixed memory ...
0 2 2 32768 ...
1 4 4 32768 ...
... Frag varsized memory Extent_space Free extent_space
... 32768 0 0
... 32768 0 0
NDBT_ProgramExit: 0 - OK
Information about multiple tables can be obtained in a single invocation of ndb_desc by using their names, separated by spaces. All of the tables must be in the same database.
Beginning with NDB 7.2.9, it is possible to obtain additional
information about a specific index using the
--table (short form: -t)
option introduced in this version and supplying the name of the
index as the first argument to ndb_desc, as
shown here:
shell> ./ndb_desc uk -d test -t fish
-- uk --
Version: 3
Base table: fish
Number of attributes: 1
Logging: 0
Index type: OrderedIndex
Index status: Retrieved
-- Attributes --
name Varchar(20;latin1_swedish_ci) NOT NULL AT=SHORT_VAR ST=MEMORY
-- IndexTable 10/uk --
Version: 3
Fragment type: FragUndefined
K Value: 6
Min load factor: 78
Max load factor: 80
Temporary table: yes
Number of attributes: 2
Number of primary keys: 1
Length of frm data: 0
Row Checksum: 1
Row GCI: 1
SingleUserMode: 2
ForceVarPart: 0
FragmentCount: 4
ExtraRowGciBits: 0
ExtraRowAuthorBits: 0
TableStatus: Retrieved
-- Attributes --
name Varchar(20;latin1_swedish_ci) NOT NULL AT=SHORT_VAR ST=MEMORY
NDB$TNODE Unsigned [64] PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
-- Indexes --
PRIMARY KEY(NDB$TNODE) - UniqueHashIndex
NDBT_ProgramExit: 0 - OK
When an index is specified in this way, the
--extra-partition-info and
--extra-node-info options have
no effect.
The Version column in the output contains the
table's schema object version. For information about
interpreting this value, see
NDB Schema Object Versions.
The Extent_space and Free
extent_space columns are applicable only to
NDB tables having columns on disk; for tables
having only in-memory columns, these columns always contain the
value 0.
To illustrate their use, we modify the previous example. First, we must create the necessary Disk Data objects, as shown here:
CREATE LOGFILE GROUP lg_1
ADD UNDOFILE 'undo_1.log'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE 2M
ENGINE NDB;
ALTER LOGFILE GROUP lg_1
ADD UNDOFILE 'undo_2.log'
INITIAL_SIZE 12M
ENGINE NDB;
CREATE TABLESPACE ts_1
ADD DATAFILE 'data_1.dat'
USE LOGFILE GROUP lg_1
INITIAL_SIZE 32M
ENGINE NDB;
ALTER TABLESPACE ts_1
ADD DATAFILE 'data_2.dat'
INITIAL_SIZE 48M
ENGINE NDB;
(For more information on the statements just shown and the objects created by them, see Section 7.12.1, “NDB Cluster Disk Data Objects”, as well as CREATE LOGFILE GROUP Syntax, and CREATE TABLESPACE Syntax.)
Now we can create and populate a version of the
fish table that stores 2 of its columns on
disk (deleting the previous version of the table first, if it
already exists):
CREATE TABLE fish (
id INT(11) NOT NULL AUTO_INCREMENT,
name VARCHAR(20) NOT NULL,
length_mm INT(11) NOT NULL,
weight_gm INT(11) NOT NULL,
PRIMARY KEY pk (id),
UNIQUE KEY uk (name)
) TABLESPACE ts_1 STORAGE DISK
ENGINE=NDB;
INSERT INTO fish VALUES
('','guppy', 35, 2), ('','tuna', 2500, 150000),
('','shark', 3000, 110000), ('','manta ray', 1500, 50000),
('','grouper', 900, 125000), ('','puffer', 250, 2500);
When run against this version of the table, ndb_desc displays the following output:
shell> ./ndb_desc -c localhost fish -d test -p
-- fish --
Version: 3
Fragment type: 9
K Value: 6
Min load factor: 78
Max load factor: 80
Temporary table: no
Number of attributes: 4
Number of primary keys: 1
Length of frm data: 321
Row Checksum: 1
Row GCI: 1
SingleUserMode: 0
ForceVarPart: 1
FragmentCount: 2
TableStatus: Retrieved
-- Attributes --
id Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY AUTO_INCR
name Varchar(20;latin1_swedish_ci) NOT NULL AT=SHORT_VAR ST=MEMORY
length_mm Int NOT NULL AT=FIXED ST=DISK
weight_gm Int NOT NULL AT=FIXED ST=DISK
-- Indexes --
PRIMARY KEY(id) - UniqueHashIndex
PRIMARY(id) - OrderedIndex
uk$unique(name) - UniqueHashIndex
uk(name) - OrderedIndex
-- Per partition info --
Partition Row count Commit count Frag fixed memory ...
0 2 2 32768 ...
1 4 4 32768 ...
... Frag varsized memory Extent_space Free extent_space
... 32768 0 0
... 32768 0 0
NDBT_ProgramExit: 0 - OK
This means that 1048576 bytes are allocated from the tablespace
for this table on each partition, of which 1044440 bytes remain
free for additional storage. In other words, 1048576 - 1044440 =
4136 bytes per partition is currently being used to store the
data from this table's disk-based columns. The number of
bytes shown as Free extent_space is available
for storing on-disk column data from the fish
table only; for this reason, it is not visible when selecting
from the INFORMATION_SCHEMA.FILES
table.
The following table includes options that are specific to ndb_desc. Additional descriptions follow the table. For options common to most NDB Cluster programs (including ndb_desc), see Section 6.26, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.
Table 6.8 This table describes command-line options for the ndb_desc program
| Format | Description | Added or Removed |
|---|---|---|
| Include partition information for BLOB tables in output. Requires that the -p option also be used | All MySQL 5.5 based releases |
|
| Name of database containing table | All MySQL 5.5 based releases |
|
| Include partition-to-data-node mappings in output. Requires that the -p option also be used | All MySQL 5.5 based releases |
|
| Display information about partitions | All MySQL 5.5 based releases |
|
| Number of times to retry the connection (once per second) | All MySQL 5.5 based releases |
|
| Specify the table in which to find an index. When this option is used, -p and -n have no effect and are ignored. | ADDED: NDB 7.2.9 |
|
| Use unqualified table names | All MySQL 5.5 based releases |
Include information about subordinate
BLOB and
TEXT columns.
Use of this option also requires the use of the
--extra-partition-info
(-p) option.
Specify the database in which the table should be found.
Include information about the mappings between table partitions and the data nodes upon which they reside. This information can be useful for verifying distribution awareness mechanisms and supporting more efficient application access to the data stored in NDB Cluster.
Use of this option also requires the use of the
--extra-partition-info
(-p) option.
Print additional information about the table's partitions.
Try to connect this many times before giving up. One connect attempt is made per second.
Specify the table in which to look for an index.
This option was added in NDB 7.2.9.
Use unqualified table names.
ndb_drop_index drops the specified index from
an NDB table. It is
recommended that you use this utility only as an example for
writing NDB API applications—see the Warning
later in this section for details.
ndb_drop_index -cconnection_stringtable_nameindex-ddb_name
The statement shown above drops the index named
index from the
table in the
database.
The following table includes options that are specific to ndb_drop_index. Additional descriptions follow the table. For options common to most NDB Cluster programs (including ndb_drop_index), see Section 6.26, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.
Table 6.9 This table describes command-line options for the ndb_drop_index program
| Format | Description | Added or Removed |
|---|---|---|
|
Name of the database in which the table is found | All MySQL 5.5 based releases |
Operations performed on Cluster table indexes using the NDB API are not visible to MySQL and make the table unusable by a MySQL server. If you use this program to drop an index, then try to access the table from an SQL node, an error results, as shown here:
shell>./ndb_drop_index -c localhost dogs ix -d ctest1Dropping index dogs/idx...OK NDBT_ProgramExit: 0 - OK shell>./mysql -u jon -p ctest1Enter password: ******* Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 7 to server version: 5.5.53-ndb-7.2.27 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>SHOW TABLES;+------------------+ | Tables_in_ctest1 | +------------------+ | a | | bt1 | | bt2 | | dogs | | employees | | fish | +------------------+ 6 rows in set (0.00 sec) mysql>SELECT * FROM dogs;ERROR 1296 (HY000): Got error 4243 'Index not found' from NDBCLUSTER
In such a case, your only option for making
the table available to MySQL again is to drop the table and
re-create it. You can use either the SQL
statementDROP TABLE or the
ndb_drop_table utility (see
Section 6.12, “ndb_drop_table — Drop an NDB Table”) to drop
the table.
ndb_drop_table drops the specified
NDB table. (If you try to use this
on a table created with a storage engine other than
NDB, the attempt fails with the
error 723: No such table exists.) This
operation is extremely fast; in some cases, it can be an order
of magnitude faster than using a MySQL DROP
TABLE statement on an NDB
table.
ndb_drop_table -cconnection_stringtbl_name-ddb_name
The following table includes options that are specific to ndb_drop_table. Additional descriptions follow the table. For options common to most NDB Cluster programs (including ndb_drop_table), see Section 6.26, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.
Table 6.10 This table describes command-line options for the ndb_drop_table program
| Format | Description | Added or Removed |
|---|---|---|
|
Name of the database in which the table is found | All MySQL 5.5 based releases |
ndb_error_reporter creates an archive from data node and management node log files that can be used to help diagnose bugs or other problems with a cluster. It is highly recommended that you make use of this utility when filing reports of bugs in NDB Cluster.
The following table includes command options specific to the NDB Cluster program ndb_error_reporter. Additional descriptions follow the table. For options common to most NDB Cluster programs (including ndb_error_reporter), see Section 6.26, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.
ndb_error_reporter did not support the
--help option prior to NDB
7.2.14 (Bug #11756666, Bug #48606). The
--connection-timeout
--dry-scp, and
--skip-nodegroup
options were also added in this release (Bug #16602002).
Table 6.11 This table describes command-line options for the ndb_error_reporter program
| Format | Description | Added or Removed |
|---|---|---|
| Number of seconds to wait when connecting to nodes before timing out. | ADDED: NDB 7.2.14 |
|
| Disable scp with remote hosts; used only for testing. | ADDED: NDB 7.2.14 |
|
| Include file system data in error report; can use a large amount of disk space | All MySQL 5.5 based releases |
|
| Skip all nodes in the node group having this ID. | ADDED: NDB 7.2.14 |
ndb_error_reporterpath/to/config-file[username] [options]
This utility is intended for use on a management node host, and
requires the path to the management host configuration file
(usually named config.ini). Optionally, you
can supply the name of a user that is able to access the
cluster's data nodes using SSH, to copy the data node log files.
ndb_error_reporter then includes all of these
files in archive that is created in the same directory in which
it is run. The archive is named
ndb_error_report_,
where YYYYMMDDHHMMSS.tar.bz2YYYYMMDDHHMMSS is a datetime
string.
ndb_error_reporter also accepts the options listed here:
| Introduced | 5.5.34-ndb-7.2.14 | ||
| Command-Line Format | --connection-timeout=timeout | ||
| Permitted Values | Type | integer | |
| Default | 0 | ||
Wait this many seconds when trying to connect to nodes before timing out.
| Introduced | 5.5.34-ndb-7.2.14 | ||
| Command-Line Format | --dry-scp | ||
| Permitted Values | Type | boolean | |
| Default | TRUE | ||
Run ndb_error_reporter without using scp from remote hosts. Used for testing only.
| Command-Line Format | --fs | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
Copy the data node file systems to the management host and include them in the archive.
Because data node file systems can be extremely large, even after being compressed, we ask that you please do not send archives created using this option to Oracle unless you are specifically requested to do so.
| Introduced | 5.5.34-ndb-7.2.14 | ||
| Command-Line Format | --connection-timeout=timeout | ||
| Permitted Values | Type | integer | |
| Default | 0 | ||
Skip all nodes belong to the node group having the supplied node group ID.
ndb_index_stat provides per-fragment
statistical information about indexes on NDB
tables. This includes cache version and age, number of index
entries per partition, and memory consumption by indexes.
To obtain basic index statistics about a given
NDB table, invoke
ndb_index_stat as shown here, with the name
of the table as the first argument and the name of the database
containing this table specified immediately following it, using
the --database
(-d) option:
ndb_index_stattable-ddatabase
In this example, we use ndb_index_stat to
obtain such information about an NDB table
named mytable in the test
database:
shell> ndb_index_stat -d test mytable
table:City index:PRIMARY fragCount:2
sampleVersion:3 loadTime:1399585986 sampleCount:1994 keyBytes:7976
query cache: valid:1 sampleCount:1994 totalBytes:27916
times in ms: save: 7.133 sort: 1.974 sort per sample: 0.000
NDBT_ProgramExit: 0 - OK
sampleVersion is the version number of the
cache from which the statistics data is taken. Running
ndb_index_stat with the
--update option causes
sampleVersion to be incremented.
loadTime shows when the cache was last
updated. This is expressed as seconds since the Unix Epoch.
sampleCount is the number of index entries
found per partition. You can estimate the total number of
entries by multiplying this by the number of fragments (shown as
fragCount).
sampleCount can be compared with the
cardinality of SHOW INDEX or
INFORMATION_SCHEMA.STATISTICS,
although the latter two provide a view of the table as a whole,
while ndb_index_stat provides a per-fragment
average.
keyBytes is the number of bytes used by the
index. In this example, the primary key is an integer, which
requires four bytes for each index, so
keyBytes can be calculated in this case as
shown here:
keyBytes = sampleCount * (4 bytes per index) = 1994 * 4 = 7976
This information can also be obtained using the corresponding
column definitions from
INFORMATION_SCHEMA.COLUMNS (this
requires a MySQL Server and a MySQL client application).
totalBytes is the total memory consumed by
all indexes on the table, in bytes.
Timings shown in the preceding examples are specific to each invocation of ndb_index_stat.
The --verbose option
provides some additional output, as shown here:
shell> ndb_index_stat -d test mytable --verbose
random seed 1337010518
connected
loop 1 of 1
table:mytable index:PRIMARY fragCount:4
sampleVersion:2 loadTime:1336751773 sampleCount:0 keyBytes:0
read stats
query cache created
query cache: valid:1 sampleCount:0 totalBytes:0
times in ms: save: 20.766 sort: 0.001
disconnected
NDBT_ProgramExit: 0 - OK
shell>
The following table includes options that are specific to the NDB Cluster ndb_index_stat utility. Additional descriptions are listed following the table. For options common to most NDB Cluster programs (including ndb_index_stat), see Section 6.26, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.
Table 6.12 This table describes command-line options for the ndb_index_stat program
| Format | Description | Added or Removed |
|---|---|---|
| Name of the database containing the table. | All MySQL 5.5 based releases |
|
| Delete index statistics for the given table, stopping any auto-update previously configured. | All MySQL 5.5 based releases |
|
| Update index statistics for the given table, restarting any auto-update previously configured. | All MySQL 5.5 based releases |
|
| Print the query cache. | All MySQL 5.5 based releases |
|
| Perform a number of random range queries on first key attr (must be int unsigned). | All MySQL 5.5 based releases |
|
| Drop any statistics tables and events in NDB kernel (all statistics are lost) | All MySQL 5.5 based releases |
|
| Create all statistics tables and events in NDB kernel, if none of them already exist | All MySQL 5.5 based releases |
|
| Create any statistics tables and events in NDB kernel that do not already exist. | All MySQL 5.5 based releases |
|
| Create any statistics tables or events that do not already exist in the NDB kernel. after dropping any that are invalid. | All MySQL 5.5 based releases |
|
| Verify that NDB system index statistics and event tables exist. | All MySQL 5.5 based releases |
|
| Do not apply sys-* options to tables. | All MySQL 5.5 based releases |
|
| Do not apply sys-* options to events. | All MySQL 5.5 based releases |
|
| Turn on verbose output | All MySQL 5.5 based releases |
|
| Set the number of times to perform a given command. Default is 0. | All MySQL 5.5 based releases |
ndb_index_stat statistics options. The following options are used to generate index statistics. They work with a given table and database. They cannot be mixed with system options (see ndb_index_stat system options).
| Command-Line Format | --database=name | ||
| Permitted Values | Type | string | |
| Default | [none] | ||
| Min Value | | ||
| Max Value | | ||
The name of the database that contains the table being queried.
| Command-Line Format | --delete | ||
| Permitted Values | Type | boolean | |
| Default | false | ||
| Min Value | | ||
| Max Value | | ||
Delete the index statistics for the given table, stopping any auto-update that was previously configured.
| Command-Line Format | --update | ||
| Permitted Values | Type | boolean | |
| Default | false | ||
| Min Value | | ||
| Max Value | | ||
Update the index statistics for the given table, and restart any auto-update that was previously configured.
| Command-Line Format | --dump | ||
| Permitted Values | Type | boolean | |
| Default | false | ||
| Min Value | | ||
| Max Value | | ||
Dump the contents of the query cache.
| Command-Line Format | --query=# | ||
| Permitted Values | Type | numeric | |
| Default | 0 | ||
| Min Value | 0 | ||
| Max Value | MAX_INT | ||
Perform random range queries on first key attribute (must be int unsigned).
ndb_index_stat system options. The following options are used to generate and update the statistics tables in the NDB kernel. None of these options can be mixed with statistics options (see ndb_index_stat statistics options).
| Command-Line Format | --sys-drop | ||
| Permitted Values | Type | boolean | |
| Default | false | ||
| Min Value | | ||
| Max Value | | ||
Drop all statistics tables and events in the NDB kernel. This causes all statistics to be lost.
| Command-Line Format | --sys-create | ||
| Permitted Values | Type | boolean | |
| Default | false | ||
| Min Value | | ||
| Max Value | | ||
Create all statistics tables and events in the NDB kernel. This works only if none of them exist previously.
| Command-Line Format | --sys-create-if-not-exist | ||
| Permitted Values | Type | boolean | |
| Default | false | ||
| Min Value | | ||
| Max Value | | ||
Create any NDB system statistics tables or events (or both) that do not already exist when the program is invoked.
| Command-Line Format | --sys-create-if-not-valid | ||
| Permitted Values | Type | boolean | |
| Default | false | ||
| Min Value | | ||
| Max Value | | ||
Create any NDB system statistics tables or events that do not already exist, after dropping any that are invalid.
| Command-Line Format | --sys-check | ||
| Permitted Values | Type | boolean | |
| Default | false | ||
| Min Value | | ||
| Max Value | | ||
Verify that all required system statistics tables and events exist in the NDB kernel.
| Command-Line Format | --sys-skip-tables | ||
| Permitted Values | Type | boolean | |
| Default | false | ||
| Min Value | | ||
| Max Value | | ||
Do not apply any --sys-* options to any
statistics tables.
| Command-Line Format | --sys-skip-events | ||
| Permitted Values | Type | boolean | |
| Default | false | ||
| Min Value | | ||
| Max Value | | ||
Do not apply any --sys-* options to any
events.
| Command-Line Format | --verbose | ||
| Permitted Values | Type | boolean | |
| Default | false | ||
| Min Value | | ||
| Max Value | | ||
Turn on verbose output.
| Command-Line Format | --loops=# | ||
| Permitted Values | Type | numeric | |
| Default | 0 | ||
| Min Value | 0 | ||
| Max Value | MAX_INT | ||
Repeat commands this number of times (for use in testing).
ndb_print_backup_file obtains diagnostic information from a cluster backup file.
ndb_print_backup_file file_name
file_name is the name of a cluster
backup file. This can be any of the files
(.Data, .ctl, or
.log file) found in a cluster backup
directory. These files are found in the data node's backup
directory under the subdirectory
BACKUP-, where
## is the sequence number for the
backup. For more information about cluster backup files and
their contents, see
Section 7.3.1, “NDB Cluster Backup Concepts”.
Like ndb_print_schema_file and
ndb_print_sys_file (and unlike most of the
other NDB utilities that are
intended to be run on a management server host or to connect to
a management server) ndb_print_backup_file
must be run on a cluster data node, since it accesses the data
node file system directly. Because it does not make use of the
management server, this utility can be used when the management
server is not running, and even when the cluster has been
completely shut down.
None.
ndb_print_file obtains information from an NDB Cluster Disk Data file.
ndb_print_file [-v] [-q] file_name+
file_name is the name of an NDB
Cluster Disk Data file. Multiple filenames are accepted,
separated by spaces.
Like ndb_print_schema_file and
ndb_print_sys_file (and unlike most of the
other NDB utilities that are
intended to be run on a management server host or to connect to
a management server) ndb_print_file must be
run on an NDB Cluster data node, since it accesses the data node
file system directly. Because it does not make use of the
management server, this utility can be used when the management
server is not running, and even when the cluster has been
completely shut down.
ndb_print_file supports the following options:
-v: Make output verbose.
-q: Suppress output (quiet mode).
--help, -h,
-?: Print help message.
This option did not work correctly prior to NDB 7.2.18. (Bug #17069285)
For more information, see Section 7.12, “NDB Cluster Disk Data Tables”.
ndb_print_schema_file obtains diagnostic information from a cluster schema file.
ndb_print_schema_file file_name
file_name is the name of a cluster
schema file. For more information about cluster schema files,
see NDB Cluster Data Node File System Directory Files.
Like ndb_print_backup_file and
ndb_print_sys_file (and unlike most of the
other NDB utilities that are
intended to be run on a management server host or to connect to
a management server) ndb_print_schema_file
must be run on a cluster data node, since it accesses the data
node file system directly. Because it does not make use of the
management server, this utility can be used when the management
server is not running, and even when the cluster has been
completely shut down.
None.
ndb_print_sys_file obtains diagnostic information from an NDB Cluster system file.
ndb_print_sys_file file_name
file_name is the name of a cluster
system file (sysfile). Cluster system files are located in a
data node's data directory
(DataDir); the path
under this directory to system files matches the pattern
ndb_.
In each case, the #_fs/D#/DBDIH/P#.sysfile# represents a
number (not necessarily the same number). For more information,
see NDB Cluster Data Node File System Directory Files.
Like ndb_print_backup_file and
ndb_print_schema_file (and unlike most of the
other NDB utilities that are
intended to be run on a management server host or to connect to
a management server) ndb_print_backup_file
must be run on a cluster data node, since it accesses the data
node file system directly. Because it does not make use of the
management server, this utility can be used when the management
server is not running, and even when the cluster has been
completely shut down.
None.
Reads a redo log file, checking it for errors, printing its contents in a human-readable format, or both. ndbd_redo_log_reader is intended for use primarily by NDB Cluster developers and Support personnel in debugging and diagnosing problems.
This utility remains under development, and its syntax and behavior are subject to change in future NDB Cluster releases.
The C++ source files for ndbd_redo_log_reader
can be found in the directory
/storage/ndb/src/kernel/blocks/dblqh/redoLogReader.
The following table includes options that are specific to the NDB Cluster program ndbd_redo_log_reader. Additional descriptions follow the table. For options common to most NDB Cluster programs (including ndbd_redo_log_reader), see Section 6.26, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.
ndbd_redo_log_readerfile_name[options]
file_name is the name of a cluster
redo log file. redo log files are located in the numbered
directories under the data node's data directory
(DataDir); the path
under this directory to the redo log files matches the pattern
ndb_.
In each case, the #_fs/D#/LCP/#/T#F#.Data# represents a
number (not necessarily the same number). For more information,
see NDB Cluster Data Node File System Directory Files.
The name of the file to be read may be followed by one or more of the options listed here:
Like ndb_print_backup_file and
ndb_print_schema_file (and unlike most of the
NDB utilities that are intended to
be run on a management server host or to connect to a management
server) ndbd_redo_log_reader must be run on a
cluster data node, since it accesses the data node file system
directly. Because it does not make use of the management server,
this utility can be used when the management server is not
running, and even when the cluster has been completely shut
down.
The cluster restoration program is implemented as a separate
command-line utility ndb_restore, which can
normally be found in the MySQL bin
directory. This program reads the files created as a result of
the backup and inserts the stored information into the database.
ndb_restore must be executed once for each of
the backup files that were created by the
START BACKUP command used to
create the backup (see
Section 7.3.2, “Using The NDB Cluster Management Client to Create a Backup”).
This is equal to the number of data nodes in the cluster at the
time that the backup was created.
Before using ndb_restore, it is recommended that the cluster be running in single user mode, unless you are restoring multiple data nodes in parallel. See Section 7.8, “NDB Cluster Single User Mode”, for more information.
The following table includes options that are specific to the NDB Cluster native backup restoration program ndb_restore. Additional descriptions follow the table. For options common to most NDB Cluster programs (including ndb_restore), see Section 6.26, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.
Table 6.14 This table describes command-line options for the ndb_restore program
| Format | Description | Added or Removed |
|---|---|---|
| Append data to a tab-delimited file | All MySQL 5.5 based releases |
|
| Path to backup files directory | All MySQL 5.5 based releases |
|
| Restore from the backup with the given ID | All MySQL 5.5 based releases |
|
| Alias for --connectstring. | All MySQL 5.5 based releases |
|
| Causes indexes from a backup to be ignored; may decrease time needed to restore data. | All MySQL 5.5 based releases |
|
| Do not ignore system table during restore. Experimental only; not for production use | All MySQL 5.5 based releases |
|
| List of one or more databases to exclude (includes those not named) | All MySQL 5.5 based releases |
|
| If TRUE (the default), do not restore any intermediate tables (having names prefixed with '#sql-') that were left over from copying ALTER TABLE operations. | ADDED: NDB 7.2.17 |
|
| Causes columns from the backup version of a table that are missing from the version of the table in the database to be ignored. | All MySQL 5.5 based releases |
|
| Causes tables from the backup that are missing from the database to be ignored. | ADDED: NDB 7.2.18 |
|
| List of one or more tables to exclude (includes those in the same database that are not named); each table reference must include the database name | All MySQL 5.5 based releases |
|
| Fields are enclosed with the indicated character | All MySQL 5.5 based releases |
|
| Fields are optionally enclosed with the indicated character | All MySQL 5.5 based releases |
|
| Fields are terminated by the indicated character | All MySQL 5.5 based releases |
|
| Print binary types in hexadecimal format | All MySQL 5.5 based releases |
|
| List of one or more databases to restore (excludes those not named) | All MySQL 5.5 based releases |
|
| List of one or more tables to restore (excludes those in same database that are not named); each table reference must include the database name | All MySQL 5.5 based releases |
|
| Lines are terminated by the indicated character | All MySQL 5.5 based releases |
|
| Allow lossy conversions of column values (type demotions or changes in sign) when restoring data from backup | All MySQL 5.5 based releases |
|
| If a mysqld is connected and using binary logging, do not log the restored data | All MySQL 5.5 based releases |
|
| Do not restore objects relating to Disk Data | All MySQL 5.5 based releases |
|
| Do not upgrade array type for varsize attributes which do not already resize VAR data, and do not change column attributes | All MySQL 5.5 based releases |
|
| Nodegroup map for NDBCLUSTER storage engine. Syntax: list of (source_nodegroup, destination_nodegroup) | All MySQL 5.5 based releases |
|
| Backup is taken on node having this ID | All MySQL 5.5 based releases |
|
| Number of parallel transactions to use while restoring data | All MySQL 5.5 based releases |
|
| Allow preservation of trailing spaces (including padding) when promoting fixed-width string types to variable-width types | All MySQL 5.5 based releases |
|
| Print metadata, data and log to stdout (equivalent to --print_meta --print_data --print_log) | All MySQL 5.5 based releases |
|
| Print data to stdout | All MySQL 5.5 based releases |
|
| Print to stdout | All MySQL 5.5 based releases |
|
| Print metadata to stdout | All MySQL 5.5 based releases |
|
| Print status of restoration each given number of seconds | All MySQL 5.5 based releases |
|
| Allow attributes to be promoted when restoring data from backup | All MySQL 5.5 based releases |
|
| Causes multi-threaded rebuilding of ordered indexes found in the backup. Number of threads used is determined by setting BuildIndexThreads parameter. | All MySQL 5.5 based releases |
|
| Restore table data and logs into NDB Cluster using the NDB API | All MySQL 5.5 based releases |
|
| Restore epoch info into the status table. Convenient on a MySQL Cluster replication slave for starting replication. The row in mysql.ndb_apply_status with id 0 will be updated/inserted. | All MySQL 5.5 based releases |
|
| Restore metadata to NDB Cluster using the NDB API | All MySQL 5.5 based releases |
|
| Restore MySQL privilege tables that were previously moved to NDB. | All MySQL 5.5 based releases |
|
| Restores to a database with a different name than the original | All MySQL 5.5 based releases |
|
| Causes missing blob tables in the backup file to be ignored. | All MySQL 5.5 based releases |
|
| Skip table structure check during restoring of data | All MySQL 5.5 based releases |
|
| Causes schema objects not recognized by ndb_restore to be ignored when restoring a backup made from a newer MySQL Cluster version to an older version. | All MySQL 5.5 based releases |
|
| Creates a tab-separated .txt file for each table in the given path | All MySQL 5.5 based releases |
|
| Level of verbosity in output | All MySQL 5.5 based releases |
Typical options for this utility are shown here:
ndb_restore [-cconnection_string] -nnode_id-bbackup_id\ [-m] -r --backup_path=/path/to/backup/files
Normally, when restoring from an NDB Cluster backup,
ndb_restore requires at a minimum the
--nodeid (short form:
-n),
--backupid (short form:
-b), and
--backup_path options.
The -c option is used to specify a connection
string which tells ndb_restore where to
locate the cluster management server. (See
Section 5.3.3, “NDB Cluster Connection Strings”, for
information on connection strings.) If this option is not used,
then ndb_restore attempts to connect to a
management server on localhost:1186. This
utility acts as a cluster API node, and so requires a free
connection “slot” to connect to the cluster
management server. This means that there must be at least one
[api] or [mysqld] section
that can be used by it in the cluster
config.ini file. It is a good idea to keep
at least one empty [api] or
[mysqld] section in
config.ini that is not being used for a
MySQL server or other application for this reason (see
Section 5.3.7, “Defining SQL and Other API Nodes in an NDB Cluster”).
You can verify that ndb_restore is connected to the cluster by using the SHOW command in the ndb_mgm management client. You can also accomplish this from a system shell, as shown here:
shell> ndb_mgm -e "SHOW"
The --nodeid or -n is used to
specify the node ID of the data node on which the backup was
taken.
When restoring to a cluster with different number of data nodes from that where the backup was taken, this information helps identify the correct set or sets of files to be restored to a given node. (In such cases, multiple files usually need to be restored to a single data node.) The next few paragraphs provide an example.
Restore to a different number of data nodes. You can restore to a cluster having fewer data nodes than the original provided that the larger number of nodes is an even multiple of the smaller number. In the following example, we use a backup taken on a cluster having four data nodes to a cluster having two data nodes.
The management server for the original cluster is on host
host10. The original cluster has four
data nodes, with the node IDs and host names shown in the
following extract from the management server's
config.ini file:
[ndbd]NodeId=2HostName=host2 [ndbd] NodeId=4 HostName=host4 [ndbd] NodeId=6 HostName=host6 [ndbd] NodeId=8 HostName=host8
We assume that each data node was originally started with
ndbmtd
--ndb-connectstring=host10
or the equivalent.
Perform a backup in the normal manner. See Section 7.3.2, “Using The NDB Cluster Management Client to Create a Backup”, for information about how to do this.
The files created by the backup on each data node are listed
here, where N is the node ID and
B is the backup ID.
BACKUP-
B-0.N.Data
BACKUP-
B.N.ctl
BACKUP-
B.N.log
These files are found under
BackupDataDir/BACKUP/BACKUP-,
on each data node. For the rest of this example, we assume
that the backup ID is 1.
B
Have all of these files available for later copying to the new data nodes (where they can be accessed on the data node's local file system by ndb_restore). It is simplest to copy them all to a single location; we assume that this is what you have done.
The management server for the target cluster is on host
host20, and the target has two data
nodes, with the node IDs and host names shown, from the
management server config.ini file on
host20:
[ndbd] NodeId=3 hostname=host3 [ndbd] NodeId=5 hostname=host5
Each of the data node processes on host3
and host5 should be started with
ndbmtd -c host20
--initial or the equivalent, so
that the new (target) cluster starts with clean data node
file systems.
Copy two different sets of two backup files to each of the target data nodes. For this example, copy the backup files from nodes 2 and 6 from the original cluster to node 3 in the target cluster. These files are listed here:
BACKUP-1-0.2.Data
BACKUP-1.2.ctl
BACKUP-1.2.log
BACKUP-1-0.6.Data
BACKUP-1.6.ctl
BACKUP-1.6.log
Then copy the backup files from nodes 4 and 8 to node 5; these files are shown in the following list:
BACKUP-1-0.4.Data
BACKUP-1.4.ctl
BACKUP-1.4.log
BACKUP-1-0.8.Data
BACKUP-1.8.ctl
BACKUP-1.8.log
For the remainder of this example, we assume that the
respective backup files have been saved to the directory
/BACKUP-1 on each of nodes 3 and 5.
On each of the two target data nodes, you must restore from
both sets of backups. First, restore the backups from nodes
2 and 6 to node 3 by invoking ndb_restore
on host3 as shown here:
shell>ndb_restore -c host20shell>--nodeid=2--backupid=1--restore_data--backup_path=/BACKUP-1ndb_restore -c host20 --nodeid=4 --backupid=1 --restore_data --backup_path=/BACKUP-1
Then restore the backups from nodes 4 and 8 to node 5 by
invoking ndb_restore on
host5, like this:
shell>ndb_restore -c host20 --nodeid=6 --backupid=1 --restore_data --backup_path=/BACKUP-1shell>ndb_restore -c host20 --nodeid=8 --backupid=1 --restore_data --backup_path=/BACKUP-1
It is possible to restore data without restoring table metadata.
The default behavior when doing this is for
ndb_restore to fail with an error if table
data do not match the table schema; this can be overridden using
the --skip-table-check or -s
option.
Some of the restrictions on mismatches in column definitions
when restoring data using ndb_restore are
relaxed; when one of these types of mismatches is encountered,
ndb_restore does not stop with an error as it
did previously, but rather accepts the data and inserts it into
the target table while issuing a warning to the user that this
is being done. This behavior occurs whether or not either of the
options --skip-table-check or
--promote-attributes is in
use. These differences in column definitions are of the
following types:
Different COLUMN_FORMAT settings
(FIXED, DYNAMIC,
DEFAULT)
Different STORAGE settings
(MEMORY, DISK)
Different default values
Different distribution key settings
ndb_restore supports limited
attribute promotion in
much the same way that it is supported by MySQL replication;
that is, data backed up from a column of a given type can
generally be restored to a column using a “larger,
similar” type. For example, data from a
CHAR(20) column can be restored to a column
declared as VARCHAR(20),
VARCHAR(30), or CHAR(30);
data from a MEDIUMINT column can
be restored to a column of type
INT or
BIGINT. See
Replication of Columns Having Different Data Types, for
a table of type conversions currently supported by attribute
promotion.
Attribute promotion by ndb_restore must be enabled explicitly, as follows:
Prepare the table to which the backup is to be restored.
ndb_restore cannot be used to re-create
the table with a different definition from the original;
this means that you must either create the table manually,
or alter the columns which you wish to promote using
ALTER TABLE after restoring
the table metadata but before restoring the data.
Invoke ndb_restore with the
--promote-attributes
option (short form -A) when restoring the
table data. Attribute promotion does not occur if this
option is not used; instead, the restore operation fails
with an error.
Prior to NDB 7.2.14, conversions between character data types
and TEXT or BLOB were not
handled correctly (Bug #17325051).
Prior to NDB 7.2.18, demotion of
TEXT to
TINYTEXT was not handled
correctly (Bug #18875137).
When converting between character data types and
TEXT or BLOB, only
conversions between character types
(CHAR and
VARCHAR) and binary types
(BINARY and
VARBINARY) can be performed at
the same time. For example, you cannot promote an
INT column to
BIGINT while promoting a
VARCHAR column to TEXT in
the same invocation of ndb_restore.
Converting between TEXT columns
using different character sets is not supported. Beginning with
NDB 7.2.18, it is expressly disallowed (Bug #18875137).
When performing conversions of character or binary types to
TEXT or BLOB with
ndb_restore, you may notice that it creates
and uses one or more staging tables named
.
These tables are not needed afterwards, and are normally deleted
by ndb_restore following a successful
restoration.
table_name$STnode_id
| Command-Line Format | --lossy-conversions | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
This option is intended to complement the
--promote-attributes option.
Using --lossy-conversions allows lossy
conversions of column values (type demotions or changes in sign)
when restoring data from backup. With some exceptions, the rules
governing demotion are the same as for MySQL replication; see
Replication of Columns Having Different Data Types, for
information about specific type conversions currently supported
by attribute demotion.
ndb_restore reports any truncation of data that it performs during lossy conversions once per attribute and column.
The --preserve-trailing-spaces option (short
form -R) causes trailing spaces to be preserved
when promoting a fixed-width character data type to its
variable-width equivalent—that is, when promoting a
CHAR column value to
VARCHAR or a
BINARY column value to
VARBINARY. Otherwise, any
trailing spaces are dropped from such column values when they
are inserted into the new columns.
Although you can promote CHAR
columns to VARCHAR and
BINARY columns to
VARBINARY, you cannot promote
VARCHAR columns to
CHAR or
VARBINARY columns to
BINARY.
The -b option is used to specify the ID or
sequence number of the backup, and is the same number shown by
the management client in the Backup
message
displayed upon completion of a backup. (See
Section 7.3.2, “Using The NDB Cluster Management Client to Create a Backup”.)
backup_id completed
When restoring cluster backups, you must be sure to restore all data nodes from backups having the same backup ID. Using files from different backups will at best result in restoring the cluster to an inconsistent state, and may fail altogether.
--restore_epoch (short form:
-e) adds (or restores) epoch information to the
cluster replication status table. This is useful for starting
replication on an NDB Cluster replication slave. When this
option is used, the row in the
mysql.ndb_apply_status having
0 in the id column is
updated if it already exists; such a row is inserted if it does
not already exist. (See
Section 8.9, “NDB Cluster Backups With NDB Cluster Replication”.)
This option causes ndb_restore to output
NDB table data and logs.
This option causes ndb_restore to print
NDB table metadata.
The first time you run the ndb_restore
restoration program, you also need to restore the metadata. In
other words, you must re-create the database tables—this
can be done by running it with the
--restore_meta (-m) option.
Restoring the metadata need be done only on a single data node;
this is sufficient to restore it to the entire cluster.
The cluster should have an empty database when starting to
restore a backup. (In other words, you should start
ndbd with --initial prior
to performing the restore.)
ndb_restore does not by default restore distributed MySQL privilege tables (NDB 7.2.0 and later). This option causes ndb_restore to restore the privilege tables.
This works only if the privilege tables were converted to
NDB before the backup was taken.
For more information, see
Section 7.14, “Distributed MySQL Privileges for NDB Cluster”.
The path to the backup directory is required; this is supplied
to ndb_restore using the
--backup_path option, and must include the
subdirectory corresponding to the ID backup of the backup to be
restored. For example, if the data node's
DataDir is
/var/lib/mysql-cluster, then the backup
directory is /var/lib/mysql-cluster/BACKUP,
and the backup files for the backup with the ID 3 can be found
in /var/lib/mysql-cluster/BACKUP/BACKUP-3.
The path may be absolute or relative to the directory in which
the ndb_restore executable is located, and
may be optionally prefixed with backup_path=.
It is possible to restore a backup to a database with a
different configuration than it was created from. For example,
suppose that a backup with backup ID 12,
created in a cluster with two database nodes having the node IDs
2 and 3, is to be restored
to a cluster with four nodes. Then
ndb_restore must be run twice—once for
each database node in the cluster where the backup was taken.
However, ndb_restore cannot always restore
backups made from a cluster running one version of MySQL to a
cluster running a different MySQL version. See
Section 4.7, “Upgrading and Downgrading NDB Cluster 7.2”, for more
information.
It is not possible to restore a backup made from a newer version of NDB Cluster using an older version of ndb_restore. You can restore a backup made from a newer version of MySQL to an older cluster, but you must use a copy of ndb_restore from the newer NDB Cluster version to do so.
For example, to restore a cluster backup taken from a cluster running NDB 7.2.5 to a cluster running NDB 7.1.21, you must use the ndb_restore that comes with the NDB 7.2.5 distribution.
For more rapid restoration, the data may be restored in
parallel, provided that there is a sufficient number of cluster
connections available. That is, when restoring to multiple nodes
in parallel, you must have an [api] or
[mysqld] section in the cluster
config.ini file available for each
concurrent ndb_restore process. However, the
data files must always be applied before the logs.
When using ndb_restore to restore a backup,
VARCHAR columns created using the
old fixed format are resized and recreated using the
variable-width format now employed. This behavior can be
overridden using the
--no-upgrade option (short
form: -u) when running
ndb_restore.
The --print_data option causes
ndb_restore to direct its output to
stdout.
TEXT and
BLOB column values are always
truncated. In NDB 7.2.18 and earlier, such values are truncated
to the first 240 bytes in the output; in NDB 7.2.19 and later,
they are truncated to 256 bytes. (Bug #14571512, Bug #65467)
This cannot currently be overridden when using
--print_data.
Several additional options are available for use with the
--print_data option in generating data dumps,
either to stdout, or to a file. These are
similar to some of the options used with
mysqldump, and are shown in the following
list:
| Command-Line Format | --tab=dir_name | ||
| Permitted Values | Type | directory name | |
This option causes
--print_data to create
dump files, one per table, each named
.
It requires as its argument the path to the directory where
the files should be saved; use tbl_name.txt. for the
current directory.
| Command-Line Format | --fields-enclosed-by=char | ||
| Permitted Values | Type | string | |
| Default | | ||
Each column values are enclosed by the string passed to this option (regardless of data type; see next item).
--fields-optionally-enclosed-by=
string
| Command-Line Format | --fields-optionally-enclosed-by | ||
| Permitted Values | Type | string | |
| Default | | ||
The string passed to this option is used to enclose column
values containing character data (such as
CHAR,
VARCHAR,
BINARY,
TEXT, or
ENUM).
| Command-Line Format | --fields-terminated-by=char | ||
| Permitted Values | Type | string | |
| Default | \t (tab) | ||
The string passed to this option is used to separate column
values. The default value is a tab character
(\t).
| Command-Line Format | --hex | ||
If this option is used, all binary values are output in hexadecimal format.
| Command-Line Format | --fields-terminated-by=char | ||
| Permitted Values | Type | string | |
| Default | \t (tab) | ||
This option specifies the string used to end each line of
output. The default is a linefeed character
(\n).
| Command-Line Format | --append | ||
When used with the --tab
and --print_data
options, this causes the data to be appended to any existing
files having the same names.
If a table has no explicit primary key, then the output
generated when using the
--print_data option
includes the table's hidden primary key.
This option causes ndb_restore to print all
metadata to stdout.
The --print_log option causes
ndb_restore to output its log to
stdout.
Causes ndb_restore to print all data,
metadata, and logs to stdout. Equivalent to
using the --print_data,
--print_meta, and
--print_log options
together.
Use of --print or any of the
--print_* options is in effect performing a
dry run. Including one or more of these options causes any
output to be redirected to stdout; in such
cases, ndb_restore makes no attempt to
restore data or metadata to an NDB Cluster.
Normally, when restoring table data and metadata,
ndb_restore ignores the copy of the
NDB system table that is present in
the backup. --dont_ignore_systab_0 causes the
system table to be restored. This option is intended
for experimental and development use only, and is not
recommended in a production environment.
This option can be used to restore a backup taken from one node
group to a different node group. Its argument is a list of the
form .
source_node_group,
target_node_group
This option prevents any connected SQL nodes from writing data restored by ndb_restore to their binary logs.
This option stops ndb_restore from restoring any NDB Cluster Disk Data objects, such as tablespaces and log file groups; see Section 7.12, “NDB Cluster Disk Data Tables”, for more information about these.
ndb_restore uses single-row transactions to apply many rows concurrently. This parameter determines the number of parallel transactions (concurrent rows) that an instance of ndb_restore tries to use. By default, this is 128; the minimum is 1, and the maximum is 1024.
The work of performing the inserts is parallelized across the
threads in the data nodes involved. This mechanism is employed
for restoring bulk data from the .Data
file—that is, the fuzzy snapshot of the data; it is not
used for building or rebuilding indexes. The change log is
applied serially; index drops and builds are DDL operations and
handled separately. There is no thread-level parallelism on the
client side of the restore.
Print a status report each N seconds
while the backup is in progress. 0 (the default) causes no
status reports to be printed. The maximum is 65535.
Sets the level for the verbosity of the output. The minimum is 0; the maximum is 255. The default value is 1.
It is possible to restore only selected databases, or selected tables from a single database, using the syntax shown here:
ndb_restoreother_optionsdb_name,[db_name[,...] |tbl_name[,tbl_name][,...]]
In other words, you can specify either of the following to be restored:
All tables from one or more databases
One or more tables from a single database
--include-databases=
db_name[,db_name][,...]
| Command-Line Format | --include-databases=db-list | ||
| Permitted Values | Type | string | |
| Default | | ||
--include-tables=
db_name.tbl_name[,db_name.tbl_name][,...]
| Command-Line Format | --include-tables=table-list | ||
| Permitted Values | Type | string | |
| Default | | ||
Use the --include-databases
option or the --include-tables option for
restoring only specific databases or tables, respectively.
--include-databases takes a comma-delimited
list of databases to be restored.
--include-tables takes a comma-delimited list
of tables (in
format) to be restored.
database.table
When --include-databases or
--include-tables is used, only those databases
or tables named by the option are restored; all other databases
and tables are excluded by ndb_restore, and
are not restored.
The following table shows several invocations of
ndb_restore using
--include-* options (other options possibly
required have been omitted for clarity), and the effects these
have on restoring from an NDB Cluster backup:
| Option Used | Result |
|---|---|
--include-databases=db1 | Only tables in database db1 are restored; all tables
in all other databases are ignored |
--include-databases=db1,db2 (or
--include-databases=db1
--include-databases=db2) | Only tables in databases db1 and
db2 are restored; all tables in all
other databases are ignored |
--include-tables=db1.t1 | Only table t1 in database db1 is
restored; no other tables in db1 or
in any other database are restored |
--include-tables=db1.t2,db2.t1 (or
--include-tables=db1.t2
--include-tables=db2.t1) | Only the table t2 in database db1
and the table t1 in database
db2 are restored; no other tables in
db1, db2, or any
other database are restored |
You can also use these two options together. For example, the
following causes all tables in databases db1
and db2, together with the tables
t1 and t2 in database
db3, to be restored (and no other databases
or tables):
shell> ndb_restore [...] --include-databases=db1,db2 --include-tables=db3.t1,db3.t2
(Again we have omitted other, possibly required, options in the example just shown.)
--exclude-databases=
db_name[,db_name][,...]
| Command-Line Format | --exclude-databases=db-list | ||
| Permitted Values | Type | string | |
| Default | | ||
--exclude-tables=
db_name.tbl_name[,db_name.tbl_name][,...]
| Command-Line Format | --exclude-tables=table-list | ||
| Permitted Values | Type | string | |
| Default | | ||
It is possible to prevent one or more databases or tables from
being restored using the ndb_restore options
--exclude-databases and
--exclude-tables.
--exclude-databases takes a comma-delimited
list of one or more databases which should not be restored.
--exclude-tables takes a comma-delimited list
of one or more tables (using
format) which should not be restored.
database.table
When --exclude-databases or
--exclude-tables is used, only those databases
or tables named by the option are excluded; all other databases
and tables are restored by ndb_restore.
This table shows several invocations of
ndb_restore usng --exclude-*
options (other options possibly required have been omitted for
clarity), and the effects these options have on restoring from
an NDB Cluster backup:
| Option Used | Result |
|---|---|
--exclude-databases=db1 | All tables in all databases except db1 are restored;
no tables in db1 are restored |
--exclude-databases=db1,db2 (or
--exclude-databases=db1
--exclude-databases=db2) | All tables in all databases except db1 and
db2 are restored; no tables in
db1 or db2 are
restored |
--exclude-tables=db1.t1 | All tables except t1 in database
db1 are restored; all other tables in
db1 are restored; all tables in all
other databases are restored |
--exclude-tables=db1.t2,db2.t1 (or
--exclude-tables=db1.t2
--exclude-tables=db2.t1) | All tables in database db1 except for
t2 and all tables in database
db2 except for table
t1 are restored; no other tables in
db1 or db2 are
restored; all tables in all other databases are restored |
You can use these two options together. For example, the
following causes all tables in all databases except
for databases db1 and
db2, and tables t1 and
t2 in database db3, to be
restored:
shell> ndb_restore [...] --exclude-databases=db1,db2 --exclude-tables=db3.t1,db3.t2
(Again, we have omitted other possibly necessary options in the interest of clarity and brevity from the example just shown.)
You can use --include-* and
--exclude-* options together, subject to the
following rules:
The actions of all --include-* and
--exclude-* options are cumulative.
All --include-* and
--exclude-* options are evaluated in the
order passed to ndb_restore, from right to left.
In the event of conflicting options, the first (rightmost) option takes precedence. In other words, the first option (going from right to left) that matches against a given database or table “wins”.
For example, the following set of options causes
ndb_restore to restore all tables from
database db1 except
db1.t1, while restoring no other tables from
any other databases:
--include-databases=db1 --exclude-tables=db1.t1
However, reversing the order of the options just given simply
causes all tables from database db1 to be
restored (including db1.t1, but no tables
from any other database), because the
--include-databases option,
being farthest to the right, is the first match against database
db1 and thus takes precedence over any other
option that matches db1 or any tables in
db1:
--exclude-tables=db1.t1 --include-databases=db1
| Command-Line Format | --exclude-missing-columns | ||
It is also possible to restore only selected table columns using
the --exclude-missing-columns option. When this
option is used, ndb_restore ignores any
columns missing from tables being restored as compared to the
versions of those tables found in the backup. This option
applies to all tables being restored. If you wish to apply this
option only to selected tables or databases, you can use it in
combination with one or more of the options described in the
previous paragraph to do so, then restore data to the remaining
tables using a complementary set of these options.
| Introduced | 5.5.40-ndb-7.2.18 | ||
| Command-Line Format | --exclude-missing-tables | ||
Beginning with NDB 7.2.17, it is also possible to restore only selected tables columns using this option, which causes ndb_restore to ignore any tables from the backup that are not found in the target database.
| Command-Line Format | --disable-indexes | ||
Disable restoration of indexes during restoration of the data
from a native NDB backup. Afterwards, you can restore indexes
for all tables at once with multi-threaded building of indexes
using --rebuild-indexes,
which should be faster than rebuilding indexes concurrently for
very large tables.
| Command-Line Format | --rebuild-indexes | ||
You can use this option with ndb_restore to
cause multi-threaded rebuilding of the ordered indexes while
restoring a native NDB backup. The number of
threads used for building ordered indexes by
ndb_restore with this option is controlled by
the BuildIndexThreads
data node configuration parameter (NDB 6.3.30 and later; NDB
7.0.11 and later).
It is necessary to use this option only for the first run of
ndb_restore; this causes all ordered indexes
to be rebuilt without using --rebuild-indexes
again when restoring subsequent nodes. You should use this
option prior to inserting new rows into the database; otherwise,
it is possible for a row to be inserted that later causes a
unique constraint violation when trying to rebuild the indexes.
Building of ordered indices is parallelized with the number of
LDMs by default. Offline index builds performed during node and
system restarts can be made faster using the
BuildIndexThreads data
node configuration parameter; this parameter has no effect on
dropping and rebuilding of indexes by
ndb_restore, which is performed online.
Rebuilding of unique indexes uses disk write bandwidth for redo
logging and local checkpointing. An insufficient amount of this
bandwith can lead to redo buffer overload or log overload
errors. In such cases you can run ndb_restore
--rebuild-indexes again; the process resumes at
the point where the error occurred. You can also do this when
you have encountered temporary errors. You can repeat execution
of ndb_restore
--rebuild-indexes indefinitely; you may be able
to stop such errors by reducing the value of
DiskCheckpointSpeed to
provide additional disk bandwidth to redo logging, or reducing
the --parallelism. If the
problem is insufficient space, you can increase the size of the
redo log
(FragmentLogFileSize
node configuration parameter), or you can increase the speed at
which LCPs are performed
(DiskCheckpointSpeed), in order to free space
more quickly.
| Command-Line Format | --skip-broken-objects | ||
This option causes ndb_restore to ignore
corrupt tables while reading a native
NDB backup, and to continue
restoring any remaining tables (that are not also corrupted).
Currently, the --skip-broken-objects option
works only in the case of missing blob parts tables.
| Command-Line Format | --skip-unknown-objects | ||
This option causes ndb_restore to ignore any
schema objects it does not recognize while reading a native
NDB backup. This can be used for
restoring a backup made from a cluster running NDB Cluster 7.2
to a cluster running NDB Cluster 7.1.
--rewrite-database=
old_dbname,new_dbname
| Command-Line Format | --rewrite-database=olddb,newdb | ||
| Permitted Values | Type | string | |
| Default | none | ||
This option makes it possible to restore to a database having a
different name from that used in the backup. For example, if a
backup is made of a database named products,
you can restore the data it contains to a database named
inventory, use this option as shown here
(omitting any other options that might be required):
shell> ndb_restore --rewrite-database=product,inventory
The option can be employed multiple times in a single invocation
of ndb_restore. Thus it is possible to
restore simultaneously from a database named
db1 to a database named
db2 and from a database named
db3 to one named db4 using
--rewrite-database=db1,db2
--rewrite-database=db3,db4. Other
ndb_restore options may be used between
multiple occurrences of --rewrite-database.
In the event of conflicts between multiple
--rewrite-database options, the last
--rewrite-database option used, reading from
left to right, is the one that takes effect. For example, if
--rewrite-database=db1,db2
--rewrite-database=db1,db3 is used, only
--rewrite-database=db1,db3 is honored, and
--rewrite-database=db1,db2 is ignored. It is
also possible to restore from multiple databases to a single
database, so that --rewrite-database=db1,db3
--rewrite-database=db2,db3 restores all tables and data
from databases db1 and db2
into database db3.
When restoring from multiple backup databases into a single
target database using --rewrite-database, no
check is made for collisions between table or other object
names, and the order in which rows are restored is not
guaranteed. This means that it is possible in such cases for
rows to be overwritten and updates to be lost.
--exclude-intermediate-sql-tables[=TRUE|FALSE]
| Introduced | 5.5.37-ndb-7.2.17 | ||
| Command-Line Format | --exclude-intermediate-sql-tables[=TRUE|FALSE] | ||
| Permitted Values | Type | boolean | |
| Default | TRUE | ||
When performing copying ALTER
TABLE operations, mysqld creates
intermediate tables (whose names are prefixed with
#sql-). When TRUE, the
--exclude-intermediate-sql-tables option keeps
ndb_restore from restoring such tables that
may have been left over from such operations. This option is
TRUE by default.
The --exclude-intermediate-sql-tables option
was introduced in NDB 7.2.17. (Bug #17882305)
Error reporting.
ndb_restore reports both temporary and
permanent errors. In the case of temporary errors, it may able
to recover from them, and reports Restore successful,
but encountered temporary error, please look at
configuration in such cases.
After using ndb_restore to initialize an
NDB Cluster for use in circular replication, binary logs on
the SQL node acting as the replication slave are not
automatically created, and you must cause them to be created
manually. To cause the binary logs to be created, issue a
SHOW TABLES statement on that
SQL node before running START
SLAVE. This is a known issue in NDB Cluster.
ndb_select_all prints all rows from an
NDB table to
stdout.
ndb_select_all -cconnection_stringtbl_name-ddb_name[>file_name]
The following table includes options that are specific to the NDB Cluster native backup restoration program ndb_select_all. Additional descriptions follow the table. For options common to most NDB Cluster programs (including ndb_select_all), see Section 6.26, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.
Table 6.15 This table describes command-line options for the ndb_select_all program
| Format | Description | Added or Removed |
|---|---|---|
| Name of the database in which the table is found | All MySQL 5.5 based releases |
|
| Degree of parallelism | All MySQL 5.5 based releases |
|
| Lock type | All MySQL 5.5 based releases |
|
| Sort resultset according to index whose name is supplied | All MySQL 5.5 based releases |
|
| Sort resultset in descending order (requires order flag) | All MySQL 5.5 based releases |
|
| Print header (set to 0|FALSE to disable headers in output) | All MySQL 5.5 based releases |
|
| Output numbers in hexadecimal format | All MySQL 5.5 based releases |
|
| Set a column delimiter | All MySQL 5.5 based releases |
|
| Print disk references (useful only for Disk Data tables having nonindexed columns) | All MySQL 5.5 based releases |
|
| Print rowid | All MySQL 5.5 based releases |
|
| Include GCI in output | All MySQL 5.5 based releases |
|
| Include GCI and row epoch in output | All MySQL 5.5 based releases |
|
| Scan in tup order | All MySQL 5.5 based releases |
|
| Do not print table column data | All MySQL 5.5 based releases |
Name of the database in which the table is found. The
default value is TEST_DB.
Specifies the degree of parallelism.
--lock=,
lock_type-l
lock_type
Employs a lock when reading the table. Possible values for
lock_type are:
0: Read lock
1: Read lock with hold
2: Exclusive read lock
There is no default value for this option.
--order=,
index_name-o
index_name
Orders the output according to the index named
index_name. Note that this is the
name of an index, not of a column, and that the index must
have been explicitly named when created.
Sorts the output in descending order. This option can be
used only in conjunction with the -o
(--order) option.
Excludes column headers from the output.
Causes all numeric values to be displayed in hexadecimal format. This does not affect the output of numerals contained in strings or datetime values.
--delimiter=,
character-D
character
Causes the character to be used
as a column delimiter. Only table data columns are separated
by this delimiter.
The default delimiter is the tab character.
Adds a disk reference column to the output. The column is nonempty only for Disk Data tables having nonindexed columns.
Adds a ROWID column providing information
about the fragments in which rows are stored.
Adds a GCI column to the output showing
the global checkpoint at which each row was last updated.
See Chapter 3, NDB Cluster Overview, and
Section 7.6.2, “NDB Cluster Log Events”, for more
information about checkpoints.
Adds a ROW$GCI64 column to the output
showing the global checkpoint at which each row was last
updated, as well as the number of the epoch in which this
update occurred.
Scan the table in the order of the tuples.
Causes any table data to be omitted.
Output from a MySQL SELECT
statement:
mysql> SELECT * FROM ctest1.fish;
+----+-----------+
| id | name |
+----+-----------+
| 3 | shark |
| 6 | puffer |
| 2 | tuna |
| 4 | manta ray |
| 5 | grouper |
| 1 | guppy |
+----+-----------+
6 rows in set (0.04 sec)
Output from the equivalent invocation of ndb_select_all:
shell> ./ndb_select_all -c localhost fish -d ctest1
id name
3 [shark]
6 [puffer]
2 [tuna]
4 [manta ray]
5 [grouper]
1 [guppy]
6 rows returned
NDBT_ProgramExit: 0 - OK
Note that all string values are enclosed by square brackets
([...]) in the output of
ndb_select_all. For a further example,
consider the table created and populated as shown here:
CREATE TABLE dogs (
id INT(11) NOT NULL AUTO_INCREMENT,
name VARCHAR(25) NOT NULL,
breed VARCHAR(50) NOT NULL,
PRIMARY KEY pk (id),
KEY ix (name)
)
TABLESPACE ts STORAGE DISK
ENGINE=NDBCLUSTER;
INSERT INTO dogs VALUES
('', 'Lassie', 'collie'),
('', 'Scooby-Doo', 'Great Dane'),
('', 'Rin-Tin-Tin', 'Alsatian'),
('', 'Rosscoe', 'Mutt');
This demonstrates the use of several additional ndb_select_all options:
shell> ./ndb_select_all -d ctest1 dogs -o ix -z --gci --disk
GCI id name breed DISK_REF
834461 2 [Scooby-Doo] [Great Dane] [ m_file_no: 0 m_page: 98 m_page_idx: 0 ]
834878 4 [Rosscoe] [Mutt] [ m_file_no: 0 m_page: 98 m_page_idx: 16 ]
834463 3 [Rin-Tin-Tin] [Alsatian] [ m_file_no: 0 m_page: 34 m_page_idx: 0 ]
835657 1 [Lassie] [Collie] [ m_file_no: 0 m_page: 66 m_page_idx: 0 ]
4 rows returned
NDBT_ProgramExit: 0 - OK
ndb_select_count prints the number of rows in
one or more NDB tables. With a
single table, the result is equivalent to that obtained by using
the MySQL statement SELECT COUNT(*) FROM
.
tbl_name
ndb_select_count [-cconnection_string] -ddb_nametbl_name[,tbl_name2[, ...]]
The following table includes options that are specific to the NDB Cluster native backup restoration program ndb_select_count. Additional descriptions follow the table. For options common to most NDB Cluster programs (including ndb_select_count), see Section 6.26, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.
Table 6.16 This table describes command-line options for the ndb_select_count program
| Format | Description | Added or Removed |
|---|---|---|
|
Name of the database in which the table is found | All MySQL 5.5 based releases |
|
Degree of parallelism | All MySQL 5.5 based releases |
|
Lock type | All MySQL 5.5 based releases |
You can obtain row counts from multiple tables in the same database by listing the table names separated by spaces when invoking this command, as shown under Sample Output.
shell> ./ndb_select_count -c localhost -d ctest1 fish dogs
6 records in table fish
4 records in table dogs
NDBT_ProgramExit: 0 - OK
ndb_show_tables displays a list of all
NDB database objects in the
cluster. By default, this includes not only both user-created
tables and NDB system tables, but
NDB-specific indexes, internal
triggers, and NDB Cluster Disk Data objects as well.
The following table includes options that are specific to the NDB Cluster native backup restoration program ndb_show_tables. Additional descriptions follow the table. For options common to most NDB Cluster programs (including ndb_show_tables), see Section 6.26, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.
Table 6.17 This table describes command-line options for the ndb_show_tables program
| Format | Description | Added or Removed |
|---|---|---|
| Specifies the database in which the table is found | All MySQL 5.5 based releases |
|
| Number of times to repeat output | All MySQL 5.5 based releases |
|
| Limit output to objects of this type | All MySQL 5.5 based releases |
|
| Do not qualify table names | All MySQL 5.5 based releases |
|
| Return output suitable for MySQL LOAD DATA INFILE statement | All MySQL 5.5 based releases |
|
| Show table temporary flag | All MySQL 5.5 based releases |
ndb_show_tables [-c connection_string]
Specifies the name of the database in which the tables are found.
Specifies the number of times the utility should execute. This is 1 when this option is not specified, but if you do use the option, you must supply an integer argument for it.
Using this option causes the output to be in a format
suitable for use with
LOAD DATA
INFILE.
If specified, this causes temporary tables to be displayed.
Can be used to restrict the output to one type of object, specified by an integer type code as shown here:
1: System table
2: User-created table
3: Unique hash index
Any other value causes all NDB
database objects to be listed (the default).
If specified, this causes unqualified object names to be displayed.
Only user-created NDB Cluster tables may be accessed from
MySQL; system tables such as SYSTAB_0 are
not visible to mysqld. However, you can
examine the contents of system tables using
NDB API applications such as
ndb_select_all (see
Section 6.21, “ndb_select_all — Print Rows from an NDB Table”).
This is a Perl script that can be used to estimate the amount of
space that would be required by a MySQL database if it were
converted to use the NDBCLUSTER
storage engine. Unlike the other utilities discussed in this
section, it does not require access to an NDB Cluster (in fact,
there is no reason for it to do so). However, it does need to
access the MySQL server on which the database to be tested
resides.
A running MySQL server. The server instance does not have to provide support for NDB Cluster.
A working installation of Perl.
The DBI module, which can be obtained
from CPAN if it is not already part of your Perl
installation. (Many Linux and other operating system
distributions provide their own packages for this library.)
A MySQL user account having the necessary privileges. If you
do not wish to use an existing account, then creating one
using GRANT USAGE ON
—where
db_name.*db_name is the name of the
database to be examined—is sufficient for this
purpose.
ndb_size.pl can also be found in the MySQL
sources in storage/ndb/tools.
The following table includes options that are specific to the NDB Cluster program ndb_size.pl. Additional descriptions follow the table. For options common to most NDB Cluster programs (including ndb_size.pl), see Section 6.26, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.
Table 6.18 This table describes command-line options for the ndb_size.pl program
| Format | Description | Added or Removed |
|---|---|---|
| The database or databases to examine; accepts a comma-delimited list; the default is ALL (use all databases found on the server) | All MySQL 5.5 based releases |
|
| Specify host and optional port as host[:port] | All MySQL 5.5 based releases |
|
| Specify a socket to connect to | All MySQL 5.5 based releases |
|
| Specify a MySQL user name | All MySQL 5.5 based releases |
|
| Specify a MySQL user password | All MySQL 5.5 based releases |
|
| Set output format (text or HTML) | All MySQL 5.5 based releases |
|
| Skip any tables in a comma-separated list of tables | All MySQL 5.5 based releases |
|
| Skip any databases in a comma-separated list of databases | All MySQL 5.5 based releases |
|
| Saves all queries to the database into the file specified | All MySQL 5.5 based releases |
|
| Loads all queries from the file specified; does not connect to a database | All MySQL 5.5 based releases |
|
| Designates a table to handle unique index size calculations | All MySQL 5.5 based releases |
perl ndb_size.pl [--database={db_name|ALL}] [--hostname=host[:port]] [--socket=socket] \
[--user=user] [--password=password] \
[--help|-h] [--format={html|text}] \
[--loadqueries=file_name] [--savequeries=file_name]
By default, this utility attempts to analyze all databases on
the server. You can specify a single database using the
--database option; the default behavior can be
made explicit by using ALL for the name of
the database. You can also exclude one or more databases by
using the --excludedbs option with a
comma-separated list of the names of the databases to be
skipped. Similarly, you can cause specific tables to be skipped
by listing their names, separated by commas, following the
optional --excludetables option. A host name
can be specified using --hostname; the default
is localhost. In NDB 7.2.6 and later, you can
specify a port in addition to the host using
host:port
format for the value of --hostname. The default
port number is 3306. If necessary, you can also specify a
socket; the default is /var/lib/mysql.sock.
A MySQL user name and password can be specified the
corresponding options shown. It also possible to control the
format of the output using the --format option;
this can take either of the values html or
text, with text being the
default. An example of the text output is shown here:
shell> ndb_size.pl --database=test --socket=/tmp/mysql.sock
ndb_size.pl report for database: 'test' (1 tables)
--------------------------------------------------
Connected to: DBI:mysql:host=localhost;mysql_socket=/tmp/mysql.sock
Including information for versions: 4.1, 5.0, 5.1
test.t1
-------
DataMemory for Columns (* means varsized DataMemory):
Column Name Type Varsized Key 4.1 5.0 5.1
HIDDEN_NDB_PKEY bigint PRI 8 8 8
c2 varchar(50) Y 52 52 4*
c1 int(11) 4 4 4
-- -- --
Fixed Size Columns DM/Row 64 64 12
Varsize Columns DM/Row 0 0 4
DataMemory for Indexes:
Index Name Type 4.1 5.0 5.1
PRIMARY BTREE 16 16 16
-- -- --
Total Index DM/Row 16 16 16
IndexMemory for Indexes:
Index Name 4.1 5.0 5.1
PRIMARY 33 16 16
-- -- --
Indexes IM/Row 33 16 16
Summary (for THIS table):
4.1 5.0 5.1
Fixed Overhead DM/Row 12 12 16
NULL Bytes/Row 4 4 4
DataMemory/Row 96 96 48
(Includes overhead, bitmap and indexes)
Varsize Overhead DM/Row 0 0 8
Varsize NULL Bytes/Row 0 0 4
Avg Varside DM/Row 0 0 16
No. Rows 0 0 0
Rows/32kb DM Page 340 340 680
Fixedsize DataMemory (KB) 0 0 0
Rows/32kb Varsize DM Page 0 0 2040
Varsize DataMemory (KB) 0 0 0
Rows/8kb IM Page 248 512 512
IndexMemory (KB) 0 0 0
Parameter Minimum Requirements
------------------------------
* indicates greater than default
Parameter Default 4.1 5.0 5.1
DataMemory (KB) 81920 0 0 0
NoOfOrderedIndexes 128 1 1 1
NoOfTables 128 1 1 1
IndexMemory (KB) 18432 0 0 0
NoOfUniqueHashIndexes 64 0 0 0
NoOfAttributes 1000 3 3 3
NoOfTriggers 768 5 5 5
For debugging purposes, the Perl arrays containing the queries
run by this script can be read from the file specified using can
be saved to a file using --savequeries; a file
containing such arrays to be read in during script execution can
be specified using --loadqueries. Neither of
these options has a default value.
To produce output in HTML format, use the
--format option and redirect the output to a
file, as shown here:
shell> ndb_size.pl --database=test --socket=/tmp/mysql.sock --format=html > ndb_size.html
(Without the redirection, the output is sent to
stdout.)
The output from this script includes the following information:
Minimum values for the
DataMemory,
IndexMemory,
MaxNoOfTables,
MaxNoOfAttributes,
MaxNoOfOrderedIndexes,
MaxNoOfUniqueHashIndexes,
and MaxNoOfTriggers
configuration parameters required to accommodate the tables
analyzed.
Memory requirements for all of the tables, attributes, ordered indexes, and unique hash indexes defined in the database.
The IndexMemory and
DataMemory required
per table and table row.
ndb_waiter repeatedly (each 100 milliseconds)
prints out the status of all cluster data nodes until either the
cluster reaches a given status or the
--timeout limit is exceeded,
then exits. By default, it waits for the cluster to achieve
STARTED status, in which all nodes have
started and connected to the cluster. This can be overridden
using the --no-contact and
--not-started options.
The node states reported by this utility are as follows:
NO_CONTACT: The node cannot be contacted.
UNKNOWN: The node can be contacted, but
its status is not yet known. Usually, this means that the
node has received a
START or
RESTART command from the
management server, but has not yet acted on it.
NOT_STARTED: The node has stopped, but
remains in contact with the cluster. This is seen when
restarting the node using the management client's
RESTART command.
STARTING: The node's
ndbd process has started, but the node
has not yet joined the cluster.
STARTED: The node is operational, and has
joined the cluster.
SHUTTING_DOWN: The node is shutting down.
SINGLE USER MODE: This is shown for all
cluster data nodes when the cluster is in single user mode.
The following table includes options that are specific to the NDB Cluster native backup restoration program ndb_waiter. Additional descriptions follow the table. For options common to most NDB Cluster programs (including ndb_waiter), see Section 6.26, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.
Table 6.19 This table describes command-line options for the ndb_waiter program
| Format | Description | Added or Removed |
|---|---|---|
| Wait for cluster to reach NO CONTACT state | All MySQL 5.5 based releases |
|
| Wait for cluster to reach NOT STARTED state | All MySQL 5.5 based releases |
|
| Wait for cluster to enter single user mode | All MySQL 5.5 based releases |
|
| Wait this many seconds, then exit whether or not cluster has reached desired state; default is 2 minutes (120 seconds) | All MySQL 5.5 based releases |
|
| List of nodes not to be waited for. | All MySQL 5.5 based releases |
|
| List of nodes to be waited for. | All MySQL 5.5 based releases |
ndb_waiter [-c connection_string]
Instead of waiting for the STARTED state,
ndb_waiter continues running until the
cluster reaches NO_CONTACT status before
exiting.
Instead of waiting for the STARTED state,
ndb_waiter continues running until the
cluster reaches NOT_STARTED status before
exiting.
Time to wait. The program exits if the desired state is not achieved within this number of seconds. The default is 120 seconds (1200 reporting cycles).
The program waits for the cluster to enter single user mode.
When this option is used, ndb_waiter does not wait for the nodes whose IDs are listed. The list is comma-delimited; ranges can be indicated by dashes, as shown here:
shell> ndb_waiter --nowait-nodes=1,3,7-9
Do not use this option together with
the --wait-nodes
option.
When this option is used, ndb_waiter waits only for the nodes whose IDs are listed. The list is comma-delimited; ranges can be indicated by dashes, as shown here:
shell> ndb_waiter --wait-nodes=2,4-6,10
Do not use this option together with
the --nowait-nodes
option.
Sample Output.
Shown here is the output from ndb_waiter
when run against a 4-node cluster in which two nodes have been
shut down and then started again manually. Duplicate reports
(indicated by ...) are omitted.
shell> ./ndb_waiter -c localhost
Connecting to mgmsrv at (localhost)
State node 1 STARTED
State node 2 NO_CONTACT
State node 3 STARTED
State node 4 NO_CONTACT
Waiting for cluster enter state STARTED
...
State node 1 STARTED
State node 2 UNKNOWN
State node 3 STARTED
State node 4 NO_CONTACT
Waiting for cluster enter state STARTED
...
State node 1 STARTED
State node 2 STARTING
State node 3 STARTED
State node 4 NO_CONTACT
Waiting for cluster enter state STARTED
...
State node 1 STARTED
State node 2 STARTING
State node 3 STARTED
State node 4 UNKNOWN
Waiting for cluster enter state STARTED
...
State node 1 STARTED
State node 2 STARTING
State node 3 STARTED
State node 4 STARTING
Waiting for cluster enter state STARTED
...
State node 1 STARTED
State node 2 STARTED
State node 3 STARTED
State node 4 STARTING
Waiting for cluster enter state STARTED
...
State node 1 STARTED
State node 2 STARTED
State node 3 STARTED
State node 4 STARTED
Waiting for cluster enter state STARTED
NDBT_ProgramExit: 0 - OK
If no connection string is specified, then
ndb_waiter tries to connect to a management
on localhost, and reports
Connecting to mgmsrv at (null).
All NDB Cluster programs accept the options described in this section, with the following exceptions:
Users of earlier NDB Cluster versions should note that some of
these options have been changed to make them consistent with one
another as well as with mysqld. You can use
the --help option with any NDB Cluster
program—with the exception of
ndb_print_backup_file,
ndb_print_schema_file, and
ndb_print_sys_file—to view a list of
the options which the program supports.
The options in the following table are common to all NDB Cluster executables (except those noted previously in this section).
Table 6.20 This table describes command-line options common to all MySQL Cluster programs
| Format | Description | Added or Removed |
|---|---|---|
| Display help message and exit | All MySQL 5.5 based releases |
|
| Directory where character sets are installed | All MySQL 5.5 based releases |
|
| Write core on errors (defaults to TRUE in debug builds) | All MySQL 5.5 based releases |
|
| Enable output from debug calls. Can be used only for versions compiled with debugging enabled | All MySQL 5.5 based releases |
|
|
Set connection string for connecting to ndb_mgmd. Syntax: [nodeid=<id>;][host=]<hostname>[:<port>]. Overrides entries specified in NDB_CONNECTSTRING or my.cnf. | All MySQL 5.5 based releases |
| Set the host (and port, if desired) for connecting to management server | All MySQL 5.5 based releases |
|
| Set node id for this node | All MySQL 5.5 based releases |
|
| Select nodes for transactions in a more optimal way | All MySQL 5.5 based releases |
|
| Output version information and exit | All MySQL 5.5 based releases |
For options specific to individual NDB Cluster programs, see Chapter 6, NDB Cluster Programs.
See Section 5.3.8.1, “MySQL Server Options for NDB Cluster”, for mysqld options relating to NDB Cluster.
| Command-Line Format | --help | ||
--usage | |||
Prints a short list with descriptions of the available command options.
| Command-Line Format | --character-sets-dir=dir_name | ||
| Permitted Values | Type | directory name | |
| Default | | ||
Tells the program where to find character set information.
--ndb-connectstring=,
connection_string--connect-string=,
connection_string-c
connection_string
| Command-Line Format | --ndb-connectstring=connectstring | ||
--connect-string=connectstring | |||
| Permitted Values | Type | string | |
| Default | localhost:1186 | ||
This option takes an NDB Cluster connection string that specifies the management server for the application to connect to, as shown here:
shell> ndbd --ndb-connectstring="nodeid=2;host=ndb_mgmd.mysql.com:1186"
For more information, see Section 5.3.3, “NDB Cluster Connection Strings”.
| Command-Line Format | --core-file | ||
| Permitted Values | Type | boolean | |
| Default | FALSE | ||
Write a core file if the program dies. The name and location
of the core file are system-dependent. (For NDB Cluster
programs nodes running on Linux, the default location is the
program's working directory—for a data node, this
is the node's
DataDir.) For some
systems, there may be restrictions or limitations; for
example, it might be necessary to execute ulimit -c
unlimited before starting the server. Consult your
system documentation for detailed information.
If NDB Cluster was built using the --debug
option for configure, then
--core-file is enabled by default. For
regular builds, --core-file is disabled by
default.
| Command-Line Format | --debug=options | ||
| Permitted Values | Type | string | |
| Default | d:t:O,/tmp/ndb_restore.trace | ||
This option can be used only for versions compiled with debugging enabled. It is used to enable output from debug calls in the same manner as for the mysqld process.
| Command-Line Format | --ndb-mgmd-host=host[:port] | ||
| Permitted Values | Type | string | |
| Default | localhost:1186 | ||
Can be used to set the host and port number of a single
management server for the program to connect to. If the
program requires node IDs or references to multiple
management servers (or both) in its connection information,
use the
--ndb-connectstring
option instead.
| Command-Line Format | --ndb-nodeid=# | ||
| Permitted Values | Type | numeric | |
| Default | 0 | ||
Sets this node's NDB Cluster node ID. The range of permitted values depends on the node's type (data, management, or API) and the NDB Cluster software version. See Section 3.6.2, “Limits and Differences of NDB Cluster from Standard MySQL Limits”, for more information.
--ndb-optimized-node-selection
| Command-Line Format | --ndb-optimized-node-selection | ||
| Permitted Values | Type | boolean | |
| Default | TRUE | ||
Optimize selection of nodes for transactions. Enabled by default.
| Command-Line Format | --version | ||
Prints the NDB Cluster version number of the executable. The version number is relevant because not all versions can be used together, and the NDB Cluster startup process verifies that the versions of the binaries being used can co-exist in the same cluster. This is also important when performing an online (rolling) software upgrade or downgrade of NDB Cluster.
See Section 7.5, “Performing a Rolling Restart of an NDB Cluster”), for more information.