Chapter 6 NDB Cluster Programs

Table of Contents

6.1 ndbd — The NDB Cluster Data Node Daemon
6.2 ndbinfo_select_all — Select From ndbinfo Tables
6.3 ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)
6.4 ndb_mgmd — The NDB Cluster Management Server Daemon
6.5 ndb_mgm — The NDB Cluster Management Client
6.6 ndb_blob_tool — Check and Repair BLOB and TEXT columns of NDB Cluster Tables
6.7 ndb_config — Extract NDB Cluster Configuration Information
6.8 ndb_cpcd — Automate Testing for NDB Development
6.9 ndb_delete_all — Delete All Rows from an NDB Table
6.10 ndb_desc — Describe NDB Tables
6.11 ndb_drop_index — Drop Index from an NDB Table
6.12 ndb_drop_table — Drop an NDB Table
6.13 ndb_error_reporter — NDB Error-Reporting Utility
6.14 ndb_index_stat — NDB Index Statistics Utility
6.15 ndb_print_backup_file — Print NDB Backup File Contents
6.16 ndb_print_file — Print NDB Disk Data File Contents
6.17 ndb_print_schema_file — Print NDB Schema File Contents
6.18 ndb_print_sys_file — Print NDB System File Contents
6.19 ndbd_redo_log_reader — Check and Print Content of Cluster Redo Log
6.20 ndb_restore — Restore an NDB Cluster Backup
6.21 ndb_select_all — Print Rows from an NDB Table
6.22 ndb_select_count — Print Row Counts for NDB Tables
6.23 ndb_setup.py — Start browser-based Auto-Installer for NDB Cluster
6.24 ndb_show_tables — Display List of NDB Tables
6.25 ndb_size.pl — NDBCLUSTER Size Requirement Estimator
6.26 ndb_waiter — Wait for NDB Cluster to Reach a Given Status
6.27 Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs

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).

Information about the program ndb_setup.py, used to start the NDB Cluster Auto-Installer, is also included in this section. You should be aware that Section 6.23, “ndb_setup.py — Start browser-based Auto-Installer for NDB Cluster ”, contains information about the command-line client only; for information about using the GUI installer spawned by this program to configure and deploy an NDB Cluster , see Section 4.1, “The NDB Cluster Auto-Installer”.

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.

6.1 ndbd — The NDB Cluster Data Node Daemon

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.27, “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

--initial

Perform initial start of ndbd, including cleaning the file system. Consult the documentation before using this option

All MySQL 5.7 based releases

--nostart,

-n

Don't start ndbd immediately; ndbd waits for command to start from ndb_mgmd

All MySQL 5.7 based releases

--daemon,

-d

Start ndbd as daemon (default); override with --nodaemon

All MySQL 5.7 based releases

--nodaemon

Do not start ndbd as daemon; provided for testing purposes

All MySQL 5.7 based releases

--foreground

Run ndbd in foreground, provided for debugging purposes (implies --nodaemon)

All MySQL 5.7 based releases

--nowait-nodes=list

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.7 based releases

--initial-start

Perform partial initial start (requires --nowait-nodes)

All MySQL 5.7 based releases

--bind-address=name

Local bind address

All MySQL 5.7 based releases

--install[=name]

Used to install the data node process as a Windows service. Does not apply on non-Windows platforms.

All MySQL 5.7 based releases

--remove[=name]

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.7 based releases

--connect-retries=#

Set the number of times to retry a connection before giving up; 0 means 1 attempt only (and no retries)

All MySQL 5.7 based releases

--connect-delay=#

Time to wait between attempts to contact a management server, in seconds; 0 means do not wait between attempts

All MySQL 5.7 based releases

--connect-retry-delay=#

Time to wait between attempts to contact a management server, in seconds; 0 means do not wait between attempts

All MySQL 5.7 based releases


Note

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.

  • --bind-address

    Command-Line Format--bind-address=name
    Permitted ValuesTypestring
    Default

    Causes ndbd to bind to a specific network interface (host name or IP address). This option has no default value.

  • --daemon, -d

    Command-Line Format--daemon
    Permitted ValuesTypeboolean
    DefaultTRUE

    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.

  • --nodaemon

    Command-Line Format--nodaemon
    Permitted ValuesTypeboolean
    DefaultFALSE

    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.

  • --foreground

    Command-Line Format--foreground
    Permitted ValuesTypeboolean
    DefaultFALSE

    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.

  • --initial

    Command-Line Format--initial
    Permitted ValuesTypeboolean
    DefaultFALSE

    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. 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.

    Warning

    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.

    Important

    This option does not affect either of the following types of files:

    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.

  • --initial-start

    Command-Line Format--initial-start
    Permitted ValuesTypeboolean
    DefaultFALSE

    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-start
    shell> ndbd --ndb-nodeid=4 --nowait-nodes=3 --initial-start
    shell> 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.

    Important

    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 ValuesTypestring
    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.

  • --nostart, -n

    Command-Line Format--nostart
    Permitted ValuesTypeboolean
    DefaultFALSE

    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”).

  • --install[=name]

    Command-Line Format--install[=name]
    Platform SpecificWindows
    Permitted ValuesTypestring
    Defaultndbd

    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.

  • --remove[=name]

    Command-Line Format--remove[=name]
    Platform SpecificWindows
    Permitted ValuesTypestring
    Defaultndbd

    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.

  • --connect-retries=#

    Command-Line Format--connect-retries=#
    Permitted ValuesTypenumeric
    Default12
    Min Value0
    Max Value65535

    Set the number of times to retry a connection before giving up; 0 means 1 attempt only (and no retries). The default is 12 attempts. The time to wait between attempts is controlled by the --connect-retry-delay option.

  • --connect-delay=#

    Deprecated5.6.28-ndb-7.4.9
    Command-Line Format--connect-delay=#
    Permitted ValuesTypenumeric
    Default5
    Min Value0
    Max Value3600

    Determines the time to wait between attempts to contact a management server when starting (the number of attempts is controlled by the --connect-retries option). The default is 5 seconds.

    This option is deprecated, and is subject to removal in a future release of NDB Cluster . Use --connect-retry-delay instead.

  • --connect-retry-delay=#

    Command-Line Format--connect-retry-delay=#
    Permitted ValuesTypenumeric
    Default5
    Min Value0
    Max Value4294967295

    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 seconds.

    This option takes the place of the --connect-delay option, which is now deprecated and subject to removal in a future release of NDB Cluster .

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 and 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_node_id_error.log 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:

    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.

    Important

    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_node_id_trace.log.next file (see below). Error log entries are thus overwritten in a cyclical and not sequential fashion.

  • ndb_node_id_trace.log.trace_id 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.

    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_node_id_trace.log.next is the file that keeps track of the next trace file number to be assigned.

  • ndb_node_id_out.log 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.

  • ndb_node_id.pid 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.

  • ndb_node_id_signal.log 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.

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.27, “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.7 in a production setting. See Section 3.6, “Known Limitations of NDB Cluster”.

6.2 ndbinfo_select_all — Select From ndbinfo Tables

ndbinfo_select_all is a client program that selects all rows and columns from one or more tables in the ndbinfo database

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.27, “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

--delay=#

Set the delay in seconds between loops. Default is 5.

All MySQL 5.7 based releases

--loops=#,

-l

Set the number of times to perform the select. Default is 1.

All MySQL 5.7 based releases

--database=db_name,

-d

Name of the database where the table located.

All MySQL 5.7 based releases

--parallelism=#,

-p

Set the degree of parallelism.

All MySQL 5.7 based releases


  • --delay=seconds

    Command-Line Format--delay=#
    Permitted ValuesTypenumeric
    Default5
    Min Value0
    Max ValueMAX_INT

    This option sets the number of seconds to wait between executing loops. Has no effect if --loops is set to 0 or 1.

  • --loops=number, -l number

    Command-Line Format--loops=#
    Permitted ValuesTypenumeric
    Default1
    Min Value0
    Max ValueMAX_INT

    This option sets the number of times to execute the select. Use --delay to set the time between loops.

6.3 ndbmtd — The NDB Cluster Data Node Daemon (Multi-Threaded)

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:

  1. 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 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).

  2. 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.

Note

It is possible to use ndbd and ndbmtd concurrently on different data nodes in the same NDB Cluster . However, such configurations have not been tested extensively; thus, we cannot recommend doing so in a production setting at this time.

6.4 ndb_mgmd — The NDB Cluster Management Server Daemon

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.27, “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

--config-file=file,

-f

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.7 based releases

--configdir=directory,

--config-dir=directory

Specify the cluster management server's configuration cache directory

All MySQL 5.7 based releases

--bind-address=ip_address

Local bind address

All MySQL 5.7 based releases

--print-full-config,

-P

Print full configuration and exit

All MySQL 5.7 based releases

--daemon,

-d

Run ndb_mgmd in daemon mode (default)

All MySQL 5.7 based releases

--nodaemon

Do not run ndb_mgmd as a daemon

All MySQL 5.7 based releases

--interactive

Run ndb_mgmd in interactive mode (not officially supported in production; for testing purposes only)

All MySQL 5.7 based releases

--log-name=name

A name to use when writing messages applying to this node in the cluster log.

All MySQL 5.7 based releases

--no-nodeid-checks

Do not provide any node id checks

All MySQL 5.7 based releases

--mycnf

Read cluster configuration data from the my.cnf file

All MySQL 5.7 based releases

--reload

Causes the management server to compare the configuration file with its configuration cache

All MySQL 5.7 based releases

--initial

Causes the management server reload its configuration data from the configuration file, bypassing the configuration cache

All MySQL 5.7 based releases

--nowait-nodes=list

Do not wait for these management nodes when starting this management server. Also requires --ndb-nodeid to be used.

All MySQL 5.7 based releases

--config-cache[=TRUE|FALSE]

Enable the management server configuration cache; TRUE by default.

All MySQL 5.7 based releases

--install[=name]

Used to install the management server process as a Windows service. Does not apply on non-Windows platforms.

All MySQL 5.7 based releases

--remove[=name]

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.7 based releases


  • --bind-address=host[:port]

    Command-Line Format--bind-address=ip_address
    Permitted ValuesTypestring
    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.

  • --no-nodeid-checks

    Command-Line Format--no-nodeid-checks
    Permitted ValuesTypeboolean
    DefaultFALSE

    Do not perform any checks of node IDs.

  • --configdir=dir_name

    Command-Line Format--configdir=directory
     --config-dir=directory
    Permitted ValuesTypefile name
    Default$INSTALLDIR/mysql-cluster

    Specifies the cluster management server's configuration cache directory. --config-dir is an alias for this option.

  • --config-cache

    Command-Line Format--config-cache[=TRUE|FALSE]
    Permitted ValuesTypeboolean
    DefaultTRUE

    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:

    • --config-cache=0

    • --config-cache=FALSE

    • --config-cache=OFF

    • --skip-config-cache

    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.

    ndb_mgmd does not check 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 ValuesTypefile 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.

  • --mycnf

    Command-Line Format--mycnf
    Permitted ValuesTypeboolean
    DefaultFALSE

    Read configuration data from the my.cnf file.

  • --daemon, -d

    Command-Line Format--daemon
    Permitted ValuesTypeboolean
    DefaultTRUE

    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.

  • --interactive

    Command-Line Format--interactive
    Permitted ValuesTypeboolean
    DefaultFALSE

    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.

  • --initial

    Command-Line Format--initial
    Permitted ValuesTypeboolean
    DefaultFALSE

    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.

    When used together with the --config-file option, the cache is cleared only if the configuration file is actually found.

  • --log-name=name

    Command-Line Format--log-name=name
    Permitted ValuesTypestring
    DefaultMgmtSrvr

    Provides a name to be used for this node in the cluster log.

  • --nodaemon

    Command-Line Format--nodaemon
    Permitted ValuesTypeboolean
    DefaultFALSE

    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.

  • --print-full-config, -P

    Command-Line Format--print-full-config
    Permitted ValuesTypeboolean
    DefaultFALSE

    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.

  • --reload

    Command-Line Format--reload
    Permitted ValuesTypeboolean
    DefaultFALSE

    NDB Cluster 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.

  • --nowait-nodes

    Command-Line Format--nowait-nodes=list
    Permitted ValuesTypenumeric
    Default
    Min Value1
    Max Value255

    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.

    Note

    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_node_id_cluster.log 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.

    By default, when the size of the cluster log reaches one million bytes, the file is renamed to ndb_node_id_cluster.log.seq_id, where seq_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_node_id_out.log is the file used for stdout and stderr when running the management server as a daemon.

  • ndb_node_id.pid is the process ID file used when running the management server as a daemon.

  • --install[=name]

    Command-Line Format--install[=name]
    Platform SpecificWindows
    Permitted ValuesTypestring
    Defaultndb_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.

  • --remove[=name]

    Command-Line Format--remove[=name]
    Platform SpecificWindows
    Permitted ValuesTypestring
    Defaultndb_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.

6.5 ndb_mgm — The NDB Cluster Management Client

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.27, “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

--try-reconnect=#,

-t

Set the number of times to retry a connection before giving up; synonym for --connect-retries

All MySQL 5.7 based releases

--execute=name,

-e

Execute command and exit

All MySQL 5.7 based releases


  • --connect-retries=#

    Command-Line Format--connect-retries=#
    Permitted ValuesTypenumeric
    Default3
    Min Value0
    Max Value4294967295

    This option specifies the number of times following the first attempt to retry a connection before giving up (the client always tries the connection at least once). The length of time to wait per attempt is set using --connect-retry-delay.

    This option is synonymous with the --try-reconnect option, which is now deprecated.

    The default for this option this option differs from its default when used with other NDB programs. See Section 6.27, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”, for more information.

  • --execute=command, -e command

    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.

    Note

    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.

  • --try-reconnect=number

    Deprecated5.6.28-ndb-7.4.9
    Command-Line Format--try-reconnect=#
    Permitted ValuesTypeinteger
    Default3
    Min Value0
    Max Value4294967295
    Permitted Values (>= 5.7.10-ndb-7.5.0)Typenumeric
    Default12
    Min Value0
    Max Value4294967295

    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.

    This option is deprecated and subject to removal in a future release. Use --connect-retries, instead.

Additional information about using ndb_mgm can be found in Section 7.2, “Commands in the NDB Cluster Management Client”.

6.6 ndb_blob_tool — Check and Repair BLOB and TEXT columns of NDB Cluster Tables

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.27, “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-orphans

Check for orphan blob parts

All MySQL 5.7 based releases

--database=db_name,

-d

Database to find the table in.

All MySQL 5.7 based releases

--delete-orphans

Delete orphan blob parts

All MySQL 5.7 based releases

--dump-file=file

Write orphan keys to specified file

All MySQL 5.7 based releases

--verbose,

-v

Verbose output

All MySQL 5.7 based releases


  • --check-orphans

    Command-Line Format--check-orphans
    Permitted ValuesTypeboolean
    DefaultFALSE

    Check for orphaned BLOB parts in NDB Cluster tables.

  • --database=db_name, -d

    Command-Line Format--database=db_name
    Permitted ValuesTypestring
    Default[none]

    Specify the database to find the table in.

  • --delete-orphans

    Command-Line Format--delete-orphans
    Permitted ValuesTypeboolean
    DefaultFALSE

    Remove orphaned BLOB parts from NDB Cluster tables.

  • --dump-file=file

    Command-Line Format--dump-file=file
    Permitted ValuesTypefile 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.

  • --verbose

    Command-Line Format--verbose
    Permitted ValuesTypeboolean
    DefaultFALSE

    Provide extra information in the tool's output regarding its progress.

Example

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.

6.7 ndb_config — Extract NDB Cluster Configuration 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.27, “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

--nodes

Print node information ([ndbd] or [ndbd default] section of cluster configuration file) only. Cannot be used with --system or --connections.

All MySQL 5.7 based releases

--connections

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.7 based releases

--query=string,

-q

One or more query options (attributes)

All MySQL 5.7 based releases

--host=name

Specify host

All MySQL 5.7 based releases

--type=name

Specify node type

All MySQL 5.7 based releases

--nodeid,

--id

Get configuration of node with this ID

All MySQL 5.7 based releases

--fields=string,

-f

Field separator

All MySQL 5.7 based releases

--rows=string,

-r

Row separator

All MySQL 5.7 based releases

--config-file=file_name

Set the path to config.ini file

All MySQL 5.7 based releases

--mycnf

Read configuration data from my.cnf file

All MySQL 5.7 based releases

-c

Short form for --ndb-connectstring

All MySQL 5.7 based releases

--configinfo

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.7 based releases

--configinfo --xml

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.7 based releases

--system

Print SYSTEM section information only (see ndb_config --configinfo output). Cannot be used with --nodes or --connections.

All MySQL 5.7 based releases

--config_from_node=#

Obtain configuration data from the node having this ID (must be a data node).

All MySQL 5.7 based releases


  • --usage, --help, or -?

    Command-Line Format--help
     --usage

    Causes ndb_config to print a list of available options, and then exit.

  • --config_from_node=#

    Command-Line Format--config_from_node=#
    Permitted ValuesTypenumeric
    Defaultnone
    Min Value1
    Max Value48

    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.)

  • --version, -V

    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 ValuesTypestring
    Defaultlocalhost: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.

  • --config-file=path-to-file

    Command-Line Format--config-file=file_name
    Permitted ValuesTypefile 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.

  • --mycnf

    Command-Line Format--mycnf
    Permitted ValuesTypeboolean
    DefaultFALSE

    Read configuration data from the my.cnf file.

  • --query=query-options, -q query-options

    Command-Line Format--query=string
    Permitted ValuesTypestring
    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.

    Note

    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.

  • --host=hostname

    Command-Line Format--host=name
    Permitted ValuesTypestring
    Default

    Specifies the host name of the node for which configuration information is to be obtained.

    Note

    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.

  • --id=node_id

    --nodeid=node_id

    Command-Line Format--ndb-nodeid=#
    Permitted ValuesTypenumeric
    Default0

    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.

  • --nodes

    Command-Line Format--nodes
    Permitted ValuesTypeboolean
    DefaultFALSE

    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.

  • --connections

    Command-Line Format--connections
    Permitted ValuesTypeboolean
    DefaultFALSE

    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.

  • --system

    Command-Line Format--system
    Permitted ValuesTypeboolean
    DefaultFALSE

    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.

  • --type=node_type

    Command-Line Format--type=name
    Permitted ValuesTypeenumeration
    Default[none]
    Valid Valuesndbd
    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 ValuesTypestring
    Default

    Specifies a delimiter string used to separate the fields in the result. The default is , (the comma character).

    Note

    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 ValuesTypestring
    Default

    Specifies a separator string used to separate the rows in the result. The default is a space character.

    Note

    If the separator contains spaces or escapes (such as \n for the linefeed character), then it must be quoted.

  • --configinfo

    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)
    …
    

    --configinfo --xml

    Command-Line Format--configinfo --xml
    Permitted ValuesTypeboolean
    Defaultfalse

    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.7.16-ndb-7.5.5"
                        ndbversion="460032" ndbversionmajor="7" ndbversionminor="5"
                        ndbversionbuild="0">
      <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="MYSQLD" primarykeys="NodeId">
        <param name="wan" comment="Use WAN TCP setting as default" type="bool"
                  default="false"/>
        <param name="HostName" comment="Name of computer for this node"
                  type="string" default=""/>
        <param name="Id" comment="NodeId" type="unsigned" mandatory="true"
                  min="1" max="255" deprecated="true"/>
        <param name="NodeId" comment="Number identifying application node (mysqld(API))"
                  type="unsigned" mandatory="true" min="1" max="255"/>
        <param name="ExecuteOnComputer" comment="HostName" type="string"
                  deprecated="true"/>
        …
      </section>
      …
    </configvariables>
    
    Note

    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).

    Deprecated parameters are indicated in the XML output by the deprecated attribute, as shown here:

    <param name="ExecuteOnComputer" comment="HostName" type="string" deprecated="true"/>
    

    In such cases, the comment refers to one or more parameters that supersede the deprecated parameter. Similarly to initial, the deprecated attribute is indicated only when the parameter is deprecated, with deprecated="true", and does not appear at all for parameters which are not deprecated. (Bug #21127135)

    Beginning with NDB 7.5.0, parameters that are required are indicated with mandatory="true", as shown here:

    <param name="NodeId"
              comment="Number identifying application node (mysqld(API))"
              type="unsigned" mandatory="true" min="1" max="255"/>
    

    In much the same way that the initial or deprecated attribute is displayed only for a parameter that requires an intial restart or that is deprecated, the mandatory attribute is included only if the given parameter is actually required.

    Important

    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.

Examples

  1. 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.

  2. 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
    
  3. 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.

  4. 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.

6.8 ndb_cpcd — Automate Testing for NDB Development

A utility having this name was formerly part of an internal automated test framework used in testing and debugging NDB Cluster . It is no longer included in NDB Cluster distributions provided by Oracle.

6.9 ndb_delete_all — Delete All Rows from an NDB Table

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.

Usage

ndb_delete_all -c connection_string tbl_name -d db_name

This deletes all rows from the table named tbl_name in the database named db_name. It is exactly equivalent to executing TRUNCATE db_name.tbl_name in MySQL.

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.27, “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

--database=dbname,

-d

Name of the database in which the table is found

All MySQL 5.7 based releases

--transactional,

-t

Perform the delete in a single transaction (may run out of operations)

All MySQL 5.7 based releases

--tupscan

Run tup scan

All MySQL 5.7 based releases

--diskscan

Run disk scan

All MySQL 5.7 based releases


  • --transactional, -t

    Use of this option causes the delete operation to be performed as a single transaction.

    Warning

    With very large tables, using this option may cause the number of operations available to the cluster to be exceeded.

6.10 ndb_desc — Describe NDB Tables

ndb_desc provides a detailed description of one or more NDB tables.

Usage

ndb_desc -c connection_string tbl_name -d db_name [options]
    
ndb_desc -c connection_string index_name -d db_name -t tbl_name

Additional options that can be used with ndb_desc are listed later in this section.

Sample Output

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
    (NULL, 'guppy', 35, 2), (NULL, 'tuna', 2500, 150000),
    (NULL, 'shark', 3000, 110000), (NULL, 'manta ray', 1500, 50000),
    (NULL, 'grouper', 900, 125000), (NULL ,'puffer', 250, 2500);

Output from ndb_desc:

shell> ./ndb_desc -c localhost fish -d test -p
-- fish --
Version: 2
Fragment type: HashMapPartition
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: 337
Max Rows: 0
Row Checksum: 1
Row GCI: 1
SingleUserMode: 0
ForceVarPart: 1
PartitionCount: 2
FragmentCount: 2
PartitionBalance: FOR_RP_BY_LDM
ExtraRowGciBits: 0
ExtraRowAuthorBits: 0
TableStatus: Retrieved
Table options:
HashMap: DEFAULT-HASHMAP-3840-2
-- 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 DYNAMIC
length_mm Int NOT NULL AT=FIXED ST=MEMORY DYNAMIC
weight_gm Int NOT NULL AT=FIXED ST=MEMORY DYNAMIC
-- Indexes --
PRIMARY KEY(id) - UniqueHashIndex
PRIMARY(id) - OrderedIndex
uk(name) - OrderedIndex
uk$unique(name) - UniqueHashIndex
-- Per partition info --
Partition       Row count       Commit count    Frag fixed memory       Frag varsized memory    Extent_space    Free extent_space
0               2               2               32768                   32768                   0               0               
1               4               4               32768                   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.

You can obtain additional information about a specific index using the --table (short form: -t) option 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: 2
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: 2
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
Max Rows: 0
Row Checksum: 1
Row GCI: 1
SingleUserMode: 2
ForceVarPart: 0
PartitionCount: 2
FragmentCount: 2
FragmentCountType: ONE_PER_LDM_PER_NODE
ExtraRowGciBits: 0
ExtraRowAuthorBits: 0
TableStatus: Retrieved
Table options:
-- 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.

Three of the table properties that can be set using NDB_TABLE comments embedded in CREATE TABLE and ALTER TABLE statements are also visible in ndb_desc output. The table's FRAGMENT_COUNT_TYPE is always shown in the FragmentCountType column. READ_ONLY and FULLY_REPLICATED, if set to 1, are shown in the Table options column. You can see this after executing the following ALTER TABLE statement in the mysql client:

mysql> ALTER TABLE fish COMMENT='NDB_TABLE=READ_ONLY=1,FULLY_REPLICATED=1';
1 row in set, 1 warning (0.00 sec)
mysql> SHOW WARNINGS\G
+---------+------+---------------------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                                 |
+---------+------+---------------------------------------------------------------------------------------------------------+
| Warning | 1296 | Got error 4503 'Table property is FRAGMENT_COUNT_TYPE=ONE_PER_LDM_PER_NODE but not in comment' from NDB |
+---------+------+---------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

The warning is issued because READ_ONLY=1 requires that the table's fragment count type is (or be set to) ONE_PER_LDM_PER_NODE_GROUP; NDB sets this automatically in such cases. You can check that the ALTER TABLE statement has the desired effect using SHOW CREATE TABLE:

mysql> SHOW CREATE TABLE fish\G
*************************** 1. row ***************************
       Table: fish
Create Table: 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 (`id`),
  UNIQUE KEY `uk` (`name`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
COMMENT='NDB_TABLE=READ_BACKUP=1,FULLY_REPLICATED=1'
1 row in set (0.01 sec)

Because FRAGMENT_COUNT_TYPE was not set explicitly, its value is not shown in the comment text printed by SHOW CREATE TABLE. ndb_desc, however, displays the updated value for this attribute. The Table options column shows the binary properties just enabled. You can see this in the output shown here (emphasized text):

shell> ./ndb_desc -c localhost fish -d test -p
-- fish --
Version: 4
Fragment type: HashMapPartition
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: 380
Max Rows: 0
Row Checksum: 1
Row GCI: 1
SingleUserMode: 0
ForceVarPart: 1
PartitionCount: 1
FragmentCount: 1
FragmentCountType: ONE_PER_LDM_PER_NODE_GROUP
ExtraRowGciBits: 0
ExtraRowAuthorBits: 0
TableStatus: Retrieved
Table options: readbackup, fullyreplicated
HashMap: DEFAULT-HASHMAP-3840-1
-- 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 DYNAMIC
length_mm Int NOT NULL AT=FIXED ST=MEMORY DYNAMIC
weight_gm Int NOT NULL AT=FIXED ST=MEMORY DYNAMIC
-- Indexes --
PRIMARY KEY(id) - UniqueHashIndex
PRIMARY(id) - OrderedIndex
uk(name) - OrderedIndex
uk$unique(name) - UniqueHashIndex
-- Per partition info --
Partition       Row count       Commit count    Frag fixed memory       Frag varsized memory    Extent_space    Free extent_space
NDBT_ProgramExit: 0 - OK

For more information about these table properties, see Setting NDB_TABLE Options in Table Comments.

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.13.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
    (NULL, 'guppy', 35, 2), (NULL, 'tuna', 2500, 150000),
    (NULL, 'shark', 3000, 110000), (NULL, 'manta ray', 1500, 50000),
    (NULL, 'grouper', 900, 125000), (NULL ,'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: 1
Fragment type: HashMapPartition
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: 346
Max Rows: 0
Row Checksum: 1
Row GCI: 1
SingleUserMode: 0
ForceVarPart: 1
PartitionCount: 2
FragmentCount: 2
FragmentCountType: ONE_PER_LDM_PER_NODE
ExtraRowGciBits: 0
ExtraRowAuthorBits: 0
TableStatus: Retrieved
Table options:
HashMap: DEFAULT-HASHMAP-3840-2
-- 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(name) - OrderedIndex
uk$unique(name) - UniqueHashIndex
-- Per partition info --
Partition       Row count       Commit count    Frag fixed memory       Frag varsized memory    Extent_space    Free extent_space
0               2               2               32768                   32768                   1048576         1044440        
1               4               4               32768                   32768                   1048576         1044400        
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.

For fully replicated tables, ndb_desc shows only the nodes holding primary partition fragment replicas; nodes with copy fragment replicas (only) are ignored. Beginning with NDB 7.5.4, you can obtain such information, using the mysql client, from the table_distribution_status, table_fragments, table_info, and table_replicas tables in the ndbinfo database.

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.27, “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

--blob-info,

-b

Include partition information for BLOB tables in output. Requires that the -p option also be used

All MySQL 5.7 based releases

--database=dbname,

-d

Name of database containing table

All MySQL 5.7 based releases

--extra-node-info,

-n

Include partition-to-data-node mappings in output. Requires that the -p option also be used

All MySQL 5.7 based releases

--extra-partition-info,

-p

Display information about partitions

All MySQL 5.7 based releases

--retries=#,

-r

Number of times to retry the connection (once per second)

All MySQL 5.7 based releases

--table=tbl_name,

-t

Specify the table in which to find an index. When this option is used, -p and -n have no effect and are ignored.

All MySQL 5.7 based releases

--unqualified,

-u

Use unqualified table names

All MySQL 5.7 based releases


  • --blob-info, -b

    Include information about subordinate BLOB and TEXT columns.

    Use of this option also requires the use of the --extra-partition-info (-p) option.

  • --database=db_name, -d

    Specify the database in which the table should be found.

  • --extra-node-info, -n

    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.

  • --extra-partition-info, -p

    Print additional information about the table's partitions.

  • --retries=#, -r

    Try to connect this many times before giving up. One connect attempt is made per second.

  • --table=tbl_name, -t

    Specify the table in which to look for an index.

  • --unqualified, -u

    Use unqualified table names.

In NDB 7.5.3 and later, table indexes listed in the output are ordered by ID. Previously, this was not deterministic and could vary between platforms. (Bug #81763, Bug #23547742)

6.11 ndb_drop_index — Drop Index from an NDB Table

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.

Usage

ndb_drop_index -c connection_string table_name index -d db_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.27, “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

--database=dbname,

-d

Name of the database in which the table is found

All MySQL 5.7 based releases


Warning

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 ctest1
Dropping index dogs/idx...OK
NDBT_ProgramExit: 0 - OK
shell> ./mysql -u jon -p ctest1
Enter 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.7.16-ndb-7.5.5
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.

6.12 ndb_drop_table — Drop an NDB 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.

Usage

ndb_drop_table -c connection_string tbl_name -d db_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.27, “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

--database=dbname,

-d

Name of the database in which the table is found

All MySQL 5.7 based releases


6.13 ndb_error_reporter — NDB Error-Reporting Utility

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.27, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.

Table 6.11 This table describes command-line options for the ndb_error_reporter program

Format Description Added or Removed

--connection-timeout=timeout

Number of seconds to wait when connecting to nodes before timing out.

All MySQL 5.7 based releases

--dry-scp

Disable scp with remote hosts; used only for testing.

All MySQL 5.7 based releases

--fs

Include file system data in error report; can use a large amount of disk space

All MySQL 5.7 based releases

--skip-nodegroup=nodegroup_id

Skip all nodes in the node group having this ID.

All MySQL 5.7 based releases


Usage

ndb_error_reporter path/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_YYYYMMDDHHMMSS.tar.bz2, where YYYYMMDDHHMMSS is a datetime string.

ndb_error_reporter also accepts the options listed here:

  • --connection-timeout=timeout

    Command-Line Format--connection-timeout=timeout
    Permitted ValuesTypeinteger
    Default0

    Wait this many seconds when trying to connect to nodes before timing out.

  • --dry-scp

    Command-Line Format--dry-scp
    Permitted ValuesTypeboolean
    DefaultTRUE

    Run ndb_error_reporter without using scp from remote hosts. Used for testing only.

  • --fs

    Command-Line Format--fs
    Permitted ValuesTypeboolean
    DefaultFALSE

    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.

  • --skip-nodegroup=nodegroup_id

    Command-Line Format--connection-timeout=timeout
    Permitted ValuesTypeinteger
    Default0

    Skip all nodes belong to the node group having the supplied node group ID.

6.14 ndb_index_stat — NDB Index Statistics Utility

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.

Usage

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_stat table -d database

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>

Options

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.27, “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

--database=name,

-d

Name of the database containing the table.

All MySQL 5.7 based releases

--delete

Delete index statistics for the given table, stopping any auto-update previously configured.

All MySQL 5.7 based releases

--update

Update index statistics for the given table, restarting any auto-update previously configured.

All MySQL 5.7 based releases

--dump

Print the query cache.

All MySQL 5.7 based releases

--query=#

Perform a number of random range queries on first key attr (must be int unsigned).

All MySQL 5.7 based releases

--sys-drop

Drop any statistics tables and events in NDB kernel (all statistics are lost)

All MySQL 5.7 based releases

--sys-create

Create all statistics tables and events in NDB kernel, if none of them already exist

All MySQL 5.7 based releases

--sys-create-if-not-exist

Create any statistics tables and events in NDB kernel that do not already exist.

All MySQL 5.7 based releases

--sys-create-if-not-valid

Create any statistics tables or events that do not already exist in the NDB kernel. after dropping any that are invalid.

All MySQL 5.7 based releases

--sys-check

Verify that NDB system index statistics and event tables exist.

All MySQL 5.7 based releases

--sys-skip-tables

Do not apply sys-* options to tables.

All MySQL 5.7 based releases

--sys-skip-events

Do not apply sys-* options to events.

All MySQL 5.7 based releases

--verbose,

-v

Turn on verbose output

All MySQL 5.7 based releases

--loops=#

Set the number of times to perform a given command. Default is 0.

All MySQL 5.7 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).

  • --database=name, -d name

    Command-Line Format--database=name
    Permitted ValuesTypestring
    Default[none]
    Min Value
    Max Value

    The name of the database that contains the table being queried.

  • --delete

    Command-Line Format--delete
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Delete the index statistics for the given table, stopping any auto-update that was previously configured.

  • --update

    Command-Line Format--update
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Update the index statistics for the given table, and restart any auto-update that was previously configured.

  • --dump

    Command-Line Format--dump
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Dump the contents of the query cache.

  • --query=#

    Command-Line Format--query=#
    Permitted ValuesTypenumeric
    Default0
    Min Value0
    Max ValueMAX_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).

  • --sys-drop

    Command-Line Format--sys-drop
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Drop all statistics tables and events in the NDB kernel. This causes all statistics to be lost.

  • --sys-create

    Command-Line Format--sys-create
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Create all statistics tables and events in the NDB kernel. This works only if none of them exist previously.

  • sys-create-if-not-exist

    Command-Line Format--sys-create-if-not-exist
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Create any NDB system statistics tables or events (or both) that do not already exist when the program is invoked.

  • --sys-create-if-not-valid

    Command-Line Format--sys-create-if-not-valid
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Create any NDB system statistics tables or events that do not already exist, after dropping any that are invalid.

  • --sys-check

    Command-Line Format--sys-check
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Verify that all required system statistics tables and events exist in the NDB kernel.

  • --sys-skip-tables

    Command-Line Format--sys-skip-tables
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Do not apply any --sys-* options to any statistics tables.

  • --sys-skip-events

    Command-Line Format--sys-skip-events
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Do not apply any --sys-* options to any events.

  • --verbose

    Command-Line Format--verbose
    Permitted ValuesTypeboolean
    Defaultfalse
    Min Value
    Max Value

    Turn on verbose output.

  • --loops=#

    Command-Line Format--loops=#
    Permitted ValuesTypenumeric
    Default0
    Min Value0
    Max ValueMAX_INT

    Repeat commands this number of times (for use in testing).

6.15 ndb_print_backup_file — Print NDB Backup File Contents

ndb_print_backup_file obtains diagnostic information from a cluster backup file.

Usage

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.

Additional Options

None.

6.16 ndb_print_file — Print NDB Disk Data File Contents

ndb_print_file obtains information from an NDB Cluster Disk Data file.

Usage

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.

Additional Options

ndb_print_file supports the following options:

  • -v: Make output verbose.

  • -q: Suppress output (quiet mode).

  • --help, -h, -?: Print help message.

For more information, see Section 7.13, “NDB Cluster Disk Data Tables”.

6.17 ndb_print_schema_file — Print NDB Schema File Contents

ndb_print_schema_file obtains diagnostic information from a cluster schema file.

Usage

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.

Additional Options

None.

6.18 ndb_print_sys_file — Print NDB System File Contents

ndb_print_sys_file obtains diagnostic information from an NDB Cluster system file.

Usage

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_#_fs/D#/DBDIH/P#.sysfile. In each case, the # 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.

Additional Options

None.

6.19 ndbd_redo_log_reader — Check and Print Content of Cluster Redo Log

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.27, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.

Table 6.13 This table describes command-line options for the ndbd_redo_log_reader program

Format Description Added or Removed

-noprint

Do not print records

All MySQL 5.7 based releases

-nocheck

Do not check records for errors

All MySQL 5.7 based releases

--help

Print usage information

All MySQL 5.7 based releases


Usage

ndbd_redo_log_reader file_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_#_fs/D#/LCP/#/T#F#.Data. In each case, the # 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:

  • Command-Line Format-noprint
    Permitted ValuesTypeboolean
    DefaultFALSE

    -noprint: Do not print the contents of the log file.

  • Command-Line Format-nocheck
    Permitted ValuesTypeboolean
    DefaultFALSE

    -nocheck: Do not check the log file for errors.

  • Command-Line Format--help

    --help: Print usage information.

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.

6.20 ndb_restore — Restore an NDB Cluster Backup

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.

Note

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.27, “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

Append data to a tab-delimited file

All MySQL 5.7 based releases

--backup_path=dir_name

Path to backup files directory

All MySQL 5.7 based releases

--backupid=#,

-b

Restore from the backup with the given ID

All MySQL 5.7 based releases

--connect,

-c

Alias for --connectstring.

All MySQL 5.7 based releases

--disable-indexes

Causes indexes from a backup to be ignored; may decrease time needed to restore data.

All MySQL 5.7 based releases

--dont_ignore_systab_0,

-f

Do not ignore system table during restore. Experimental only; not for production use

All MySQL 5.7 based releases

--exclude-databases=db-list

List of one or more databases to exclude (includes those not named)

All MySQL 5.7 based releases

--exclude-intermediate-sql-tables[=TRUE|FALSE]

If TRUE (the default), do not restore any intermediate tables (having names prefixed with '#sql-') that were left over from copying ALTER TABLE operations.

All MySQL 5.7 based releases

--exclude-missing-columns

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.7 based releases

--exclude-missing-tables

Causes tables from the backup that are missing from the database to be ignored.

All MySQL 5.7 based releases

--exclude-tables=table-list

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.7 based releases

--fields-enclosed-by=char

Fields are enclosed with the indicated character

All MySQL 5.7 based releases

--fields-optionally-enclosed-by

Fields are optionally enclosed with the indicated character

All MySQL 5.7 based releases

--fields-terminated-by=char

Fields are terminated by the indicated character

All MySQL 5.7 based releases

--hex

Print binary types in hexadecimal format

All MySQL 5.7 based releases

--include-databases=db-list

List of one or more databases to restore (excludes those not named)

All MySQL 5.7 based releases

--include-tables=table-list

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.7 based releases

--lines-terminated-by=char

Lines are terminated by the indicated character

All MySQL 5.7 based releases

--lossy-conversions,

-L

Allow lossy conversions of column values (type demotions or changes in sign) when restoring data from backup

All MySQL 5.7 based releases

--no-binlog

If a mysqld is connected and using binary logging, do not log the restored data

All MySQL 5.7 based releases

--no-restore-disk-objects,

-d

Do not restore objects relating to Disk Data

All MySQL 5.7 based releases

--no-upgrade,

-u

Do not upgrade array type for varsize attributes which do not already resize VAR data, and do not change column attributes

All MySQL 5.7 based releases

--ndb-nodegroup-map=map,

-z

Nodegroup map for NDBCLUSTER storage engine. Syntax: list of (source_nodegroup, destination_nodegroup)

All MySQL 5.7 based releases

--nodeid=#,

-n

Backup is taken on node having this ID

All MySQL 5.7 based releases

--parallelism=#,

-p

Number of parallel transactions to use while restoring data

All MySQL 5.7 based releases

--preserve-trailing-spaces,

-P

Allow preservation of trailing spaces (including padding) when promoting fixed-width string types to variable-width types

All MySQL 5.7 based releases

--print

Print metadata, data and log to stdout (equivalent to --print_meta --print_data --print_log)

All MySQL 5.7 based releases

--print_data

Print data to stdout

All MySQL 5.7 based releases

--print_log

Print to stdout

All MySQL 5.7 based releases

--print_meta

Print metadata to stdout

All MySQL 5.7 based releases

print-sql-log

Write SQL log to stdout; default is FALSE

ADDED: NDB 7.5.4

--progress-frequency=#

Print status of restoration each given number of seconds

All MySQL 5.7 based releases

--promote-attributes,

-A

Allow attributes to be promoted when restoring data from backup

All MySQL 5.7 based releases

--rebuild-indexes

Causes multi-threaded rebuilding of ordered indexes found in the backup. Number of threads used is determined by setting BuildIndexThreads parameter.

All MySQL 5.7 based releases

--restore_data,

-r

Restore table data and logs into NDB Cluster using the NDB API

All MySQL 5.7 based releases

--restore_epoch,

-e

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.7 based releases

--restore_meta,

-m

Restore metadata to NDB Cluster using the NDB API

All MySQL 5.7 based releases

--restore-privilege-tables

Restore MySQL privilege tables that were previously moved to NDB.

All MySQL 5.7 based releases

--rewrite-database=olddb,newdb

Restores to a database with a different name than the original

All MySQL 5.7 based releases

--skip-broken-objects

Causes missing blob tables in the backup file to be ignored.

All MySQL 5.7 based releases

--skip-table-check,

-s

Skip table structure check during restoring of data

All MySQL 5.7 based releases

--skip-unknown-objects

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.7 based releases

--tab=dir_name,

-T dir_name

Creates a tab-separated .txt file for each table in the given path

All MySQL 5.7 based releases

--verbose=#

Level of verbosity in output

All MySQL 5.7 based releases


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. In addition, when ndb_restore is used to restore any tables containing unique indexes, you must include --disable-indexes or --rebuild-indexes. (Bug #57782, Bug #11764893)

Typical options for this utility are shown here:

ndb_restore [-c connection_string] -n node_id -b backup_id \
      [-m] -r --backup_path=/path/to/backup/files

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.

  1. 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=2
    HostName=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.

  2. 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.

  3. 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-B, on each data node. For the rest of this example, we assume that the backup ID is 1.

    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.

  4. 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.

  5. 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.

  6. 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 host20 --nodeid=2 --backupid=1 --restore_data --backup_path=/BACKUP-1
    shell> ndb_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-1
    shell> 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:

  1. 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.

  2. 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.

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, and is expressly disallowed.

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 table_name$STnode_id. These tables are not needed afterwards, and are normally deleted by ndb_restore following a successful restoration.

--lossy-conversions, -L

Command-Line Format--lossy-conversions
Permitted ValuesTypeboolean
DefaultFALSE

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.

Note

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 backup_id completed message displayed upon completion of a backup. (See Section 7.3.2, “Using The NDB Cluster Management Client to Create a Backup”.)

Important

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”.)

--restore_data

This option causes ndb_restore to output NDB table data and logs.

--restore_meta

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.

Note

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.)

--restore-privilege-tables

ndb_restore does not by default restore distributed MySQL privilege tables. 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.15, “Distributed MySQL Privileges for NDB Cluster”.

--backup_path

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.8, “Upgrading and Downgrading NDB Cluster”, for more information.

Important

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 Cluster 7.5.5 to a cluster running NDB Cluster 7.4.14, you must use the ndb_restore that comes with the NDB Cluster 7.5.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.

--no-upgrade

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.

--print_data

The --print_data option causes ndb_restore to direct its output to stdout.

TEXT and BLOB column values are always truncated. Such values are truncated to the first 256 bytes in the output. 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:

  • --tab, -T

    Command-Line Format--tab=dir_name
    Permitted ValuesTypedirectory name

    This option causes --print_data to create dump files, one per table, each named tbl_name.txt. It requires as its argument the path to the directory where the files should be saved; use . for the current directory.

  • --fields-enclosed-by=string

    Command-Line Format--fields-enclosed-by=char
    Permitted ValuesTypestring
    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 ValuesTypestring
    Default

    The string passed to this option is used to enclose column values containing character data (such as CHAR, VARCHAR, BINARY, TEXT, or ENUM).

  • --fields-terminated-by=string

    Command-Line Format--fields-terminated-by=char
    Permitted ValuesTypestring
    Default\t (tab)

    The string passed to this option is used to separate column values. The default value is a tab character (\t).

  • --hex

    Command-Line Format--hex

    If this option is used, all binary values are output in hexadecimal format.

  • --fields-terminated-by=string

    Command-Line Format--fields-terminated-by=char
    Permitted ValuesTypestring
    Default\t (tab)

    This option specifies the string used to end each line of output. The default is a linefeed character (\n).

  • --append

    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.

Note

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.

--print_meta

This option causes ndb_restore to print all metadata to stdout.

--print_log

The --print_log option causes ndb_restore to output its log to stdout.

--print

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.

Note

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 .

--print-sql-log

Causes ndb_restore to log SQL statements to stdout. Use the option to enable; normally disabled. This option checks before attempting to log whether all the tables being restored have explicitly defined primary keys; queries on a table having only the hidden primary key implemented by NDB cannot be converted to valid SQL.

The --print-sql-log option was added in NDB 7.5.4. (Bug #13511949)

--dont_ignore_systab_0

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.

--ndb-nodegroup-map, -z

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.

--no-binlog

This option prevents any connected SQL nodes from writing data restored by ndb_restore to their binary logs.

--no-restore-disk-objects, -d

This option stops ndb_restore from restoring any NDB Cluster Disk Data objects, such as tablespaces and log file groups; see Section 7.13, “NDB Cluster Disk Data Tables”, for more information about these.

--parallelism=#, -p

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.

--progress-frequency=N

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.

--verbose=#

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_restore other_options db_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 ValuesTypestring
Default

--include-tables=db_name.tbl_name[,db_name.tbl_name][,...]

Command-Line Format--include-tables=table-list
Permitted ValuesTypestring
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 database.table format) to be restored.

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 UsedResult
--include-databases=db1Only 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.t1Only 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 ValuesTypestring
Default

--exclude-tables=db_name.tbl_name[,db_name.tbl_name][,...]

Command-Line Format--exclude-tables=table-list
Permitted ValuesTypestring
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 database.table format) which should not be restored.

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 UsedResult
--exclude-databases=db1All 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.t1All 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

--exclude-missing-columns

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.

--exclude-missing-tables

Command-Line Format--exclude-missing-tables

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.

--disable-indexes

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.

--rebuild-indexes

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 and the number of LDMs.

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 --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 (MaxDiskWriteSpeed and related parameters), in order to free space more quickly.

--skip-broken-objects

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.

--skip-unknown-objects

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 7.5 to a cluster running NDB Cluster 7.4.

--rewrite-database=old_dbname,new_dbname

Command-Line Format--rewrite-database=olddb,newdb
Permitted ValuesTypestring
Defaultnone

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.

Important

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]

Command-Line Format--exclude-intermediate-sql-tables[=TRUE|FALSE]
Permitted ValuesTypeboolean
DefaultTRUE

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.

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.

Important

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 .

6.21 ndb_select_all — Print Rows from an NDB Table

ndb_select_all prints all rows from an NDB table to stdout.

Usage

ndb_select_all -c connection_string tbl_name -d db_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.27, “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

--database=dbname,

-d

Name of the database in which the table is found

All MySQL 5.7 based releases

--parallelism=#,

-p

Degree of parallelism

All MySQL 5.7 based releases

--lock=#,

-l

Lock type

All MySQL 5.7 based releases

--order=index,

-o

Sort resultset according to index whose name is supplied

All MySQL 5.7 based releases

--descending,

-z

Sort resultset in descending order (requires order flag)

All MySQL 5.7 based releases

--header,

-h

Print header (set to 0|FALSE to disable headers in output)

All MySQL 5.7 based releases

--useHexFormat,

-x

Output numbers in hexadecimal format

All MySQL 5.7 based releases

--delimiter=char,

-D

Set a column delimiter

All MySQL 5.7 based releases

--disk

Print disk references (useful only for Disk Data tables having nonindexed columns)

All MySQL 5.7 based releases

--rowid

Print rowid

All MySQL 5.7 based releases

--gci

Include GCI in output

All MySQL 5.7 based releases

--gci64

Include GCI and row epoch in output

All MySQL 5.7 based releases

--tupscan,

-t

Scan in tup order

All MySQL 5.7 based releases

--nodata

Do not print table column data

All MySQL 5.7 based releases


  • --database=dbname, -d dbname

    Name of the database in which the table is found. The default value is TEST_DB.

  • parallelism=#, -p #

    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

    This is the name of an index, not of a column; the index must have been explicitly named when created.

  • --descending, -z

    Sorts the output in descending order. This option can be used only in conjunction with the -o (--order) option.

  • --header=FALSE

    Excludes column headers from the output.

  • --useHexFormat -x

    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.

  • --disk

    Adds a disk reference column to the output. The column is nonempty only for Disk Data tables having nonindexed columns.

  • --rowid

    Adds a ROWID column providing information about the fragments in which rows are stored.

  • --gci

    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.

  • --gci64

    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.

  • --tupscan, -t

    Scan the table in the order of the tuples.

  • --nodata

    Causes any table data to be omitted.

Sample Output

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

All string values are enclosed by square brackets ([...]) in the output of ndb_select_all. For another 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

6.22 ndb_select_count — Print Row Counts for NDB Tables

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.

Usage

ndb_select_count [-c connection_string] -ddb_name tbl_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.27, “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

--database=dbname,

-d

Name of the database in which the table is found

All MySQL 5.7 based releases

--parallelism=#,

-p

Degree of parallelism

All MySQL 5.7 based releases

--lock=#,

-l

Lock type

All MySQL 5.7 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.

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

6.23 ndb_setup.py — Start browser-based Auto-Installer for NDB Cluster

ndb_setup.py starts the NDB Cluster Auto-Installer and opens the installer's Start page in the default Web browser.

This section describes usage of and program options for the command-line tool only. For information about using the Auto-Installer GUI that is spawned when ndb_setup.py is invoked, see Section 4.1, “The NDB Cluster Auto-Installer”.

Usage

All platforms:

ndb_setup.py [options]

Additionally, on Windows platforms only:

setup.bat [options]

The following table includes all options that are supported by the NDB Cluster installation and configuration program ndb_setup.py. Additional descriptions follow the table.

Table 6.17 This table describes command-line options for the ndb_setup.py program

Format Description Added or Removed

--browser-start-page=filename,

-s

Page that the web browser opens when starting.

All MySQL 5.7 based releases

--ca-certs-file=filename,

-a

File containing list of client certificates allowed to connect to the server

All MySQL 5.7 based releases

--cert-file=filename,

-c

File containing X509 certificate that identifies the server. (Default: cfg.pem)

All MySQL 5.7 based releases

--debug-level=level,

-d

Python logging module debug level. One of DEBUG, INFO, WARNING (default), ERROR, or CRITICAL.

All MySQL 5.7 based releases

--help,

-h

Print help message

All MySQL 5.7 based releases

--key-file=file,

-k

Specify file containing private key (if not included in --cert-file)

All MySQL 5.7 based releases

--no-browser,

-n

Do not open the start page in a browser, merely start the tool

All MySQL 5.7 based releases

--port=#,

-p

Specify the port used by the web server

All MySQL 5.7 based releases

--server-log-file=file,

o

Log requests to this file. Use '-' to force logging to stderr instead.

All MySQL 5.7 based releases

--server-name=name,

-N

The name of the server to connect with

All MySQL 5.7 based releases

--use-https,

-S

Use secure (HTTPS) client-server connection

All MySQL 5.7 based releases


  • --browser-start-page=file, -s

    Command-Line Format--browser-start-page=filename
    Permitted ValuesTypestring
    Defaultindex.html

    Specify the file to open in the browser as the installation and configuration Start page. The default is index.html.

  • --ca-certs-file=file, -a

    Command-Line Format--ca-certs-file=filename
    Permitted ValuesTypefile name
    Default[none]

    Specify a file containing a list of client certificates which are allowed to connect to the server. The default is an empty string, which means that no client authentication is used.

  • --cert-file=file, -c

    Command-Line Format--cert-file=filename
    Permitted ValuesTypefile name
    Defaultcfg.pem

    Specify a file containing an X509 certificate which identifies the server. It is possible for the certificate to be self-signed. The default is cfg.pem.

  • --debug-level=level, -d

    Command-Line Format--debug-level=level
    Permitted ValuesTypeenumeration
    DefaultWARNING
    Valid ValuesWARNING
    DEBUG
    INFO
    ERROR
    CRITICAL

    Set the Python logging module debug level. This is one of DEBUG, INFO, WARNING, ERROR, or CRITICAL. WARNING is the default.

  • --help, -h

    Command-Line Format--help

    Print a help message.

  • --key-file=file, -d

    Command-Line Format--key-file=file
    Permitted ValuesTypefile name
    Default[none]

    Specify a file containing the private key if this is not included in the X509 certificate file (--cert-file). The default is an empty string, which means that no such file is used.

  • --no-browser, -n

    Command-Line Format--no-browser

    Start the installation and configuration tool, but do not open the Start page in a browser.

  • --port=#, -p

    Command-Line Format--port=#
    Permitted ValuesTypenumeric
    Default8081
    Min Value1
    Max Value65535

    Set the port used by the web server. The default is 8081.

  • --server-log-file=file, -o

    Command-Line Format--server-log-file=file
     o
    Permitted ValuesTypefile name
    Defaultndb_setup.log
    Valid Valuesndb_setup.log
    - (Log to stderr)

    Log requests to this file. The default is ndb_setup.log. To specify logging to stderr, rather than to a file, use a - (dash character) for the file name.

  • --server-name=host, -N

    Command-Line Format--server-name=name
    Permitted ValuesTypestring
    Defaultlocalhost

    Specify the host name or IP address for the browser to use when connecting. The default is localhost.

  • --use-https, -S

    Command-Line Format--use-https

    Make the browser use a secure (HTTPS) connection with the server.

6.24 ndb_show_tables — Display List of NDB Tables

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.27, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.

Table 6.18 This table describes command-line options for the ndb_show_tables program

Format Description Added or Removed

--database=string,

-d

Specifies the database in which the table is found

All MySQL 5.7 based releases

--loops=#,

-l

Number of times to repeat output

All MySQL 5.7 based releases

--type=#,

-t

Limit output to objects of this type

All MySQL 5.7 based releases

--unqualified,

-u

Do not qualify table names

All MySQL 5.7 based releases

--parsable,

-p

Return output suitable for MySQL LOAD DATA INFILE statement

All MySQL 5.7 based releases

--show-temp-status

Show table temporary flag

All MySQL 5.7 based releases


Usage

ndb_show_tables [-c connection_string]
  • --database, -d

    Specifies the name of the database in which the tables are found. If this option has not been specified, and no tables are found in the TEST_DB database, ndb_show_tables issues a warning.

  • --loops, -l

    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.

  • --parsable, -p

    Using this option causes the output to be in a format suitable for use with LOAD DATA INFILE.

  • --show-temp-status

    If specified, this causes temporary tables to be displayed.

  • --type, -t

    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).

  • --unqualified, -u

    If specified, this causes unqualified object names to be displayed.

Note

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”).

6.25 ndb_size.pl — NDBCLUSTER Size Requirement Estimator

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.

Requirements

  • 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 db_name.*—where 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.27, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.

Table 6.19 This table describes command-line options for the ndb_size.pl program

Format Description Added or Removed

--database=dbname

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.7 based releases

--hostname[:port]

Specify host and optional port as host[:port]

All MySQL 5.7 based releases

--socket=file_name

Specify a socket to connect to

All MySQL 5.7 based releases

--user=string

Specify a MySQL user name

All MySQL 5.7 based releases

--password=string

Specify a MySQL user password

All MySQL 5.7 based releases

--format=string

Set output format (text or HTML)

All MySQL 5.7 based releases

--excludetables=tbl_list

Skip any tables in a comma-separated list of tables

All MySQL 5.7 based releases

--excludedbs=db_list

Skip any databases in a comma-separated list of databases

All MySQL 5.7 based releases

--savequeries=file

Saves all queries to the database into the file specified

All MySQL 5.7 based releases

--loadqueries=file

Loads all queries from the file specified; does not connect to a database

All MySQL 5.7 based releases

--real_table_name=table

Designates a table to handle unique index size calculations

All MySQL 5.7 based releases


Usage

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. 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:

6.26 ndb_waiter — Wait for NDB Cluster to Reach a Given Status

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.27, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.

Table 6.20 This table describes command-line options for the ndb_waiter program

Format Description Added or Removed

--no-contact,

-n

Wait for cluster to reach NO CONTACT state

All MySQL 5.7 based releases

--not-started

Wait for cluster to reach NOT STARTED state

All MySQL 5.7 based releases

--single-user

Wait for cluster to enter single user mode

All MySQL 5.7 based releases

--timeout=#,

-t

Wait this many seconds, then exit whether or not cluster has reached desired state; default is 2 minutes (120 seconds)

All MySQL 5.7 based releases

--nowait-nodes=list

List of nodes not to be waited for.

All MySQL 5.7 based releases

--wait-nodes=list,

-w

List of nodes to be waited for.

All MySQL 5.7 based releases


Usage

ndb_waiter [-c connection_string]

Additional Options

  • --no-contact, -n

    Instead of waiting for the STARTED state, ndb_waiter continues running until the cluster reaches NO_CONTACT status before exiting.

  • --not-started

    Instead of waiting for the STARTED state, ndb_waiter continues running until the cluster reaches NOT_STARTED status before exiting.

  • --timeout=seconds, -t seconds

    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).

  • --single-user

    The program waits for the cluster to enter single user mode.

  • --nowait-nodes=list

    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
    
    Important

    Do not use this option together with the --wait-nodes option.

  • --wait-nodes=list, -w list

    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
    
    Important

    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
Note

If no connection string is specified, then ndb_waiter tries to connect to a management on localhost, and reports Connecting to mgmsrv at (null).

6.27 Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs

All NDB Cluster programs accept the options described in this section, with the following exceptions:

Note

Users of earlier NDB Cluster versions should note that some of these options have been changed to make them consistent with one another, and also 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.21 This table describes command-line options common to all MySQL Cluster programs

Format Description Added or Removed

--help,

--usage,

-?

Display help message and exit

All MySQL 5.7 based releases

--character-sets-dir=dir_name

Directory where character sets are installed

All MySQL 5.7 based releases

--connect-retries=#

Set the number of times to retry a connection before giving up

All MySQL 5.7 based releases

--connect-retry-delay=#

Time to wait between attempts to contact a management server, in seconds

All MySQL 5.7 based releases

--core-file

Write core on errors (defaults to TRUE in debug builds)

All MySQL 5.7 based releases

--debug=options

Enable output from debug calls. Can be used only for versions compiled with debugging enabled

All MySQL 5.7 based releases

--ndb-connectstring=connectstring,

--connect-string=connectstring,

-c

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.7 based releases

--ndb-mgmd-host=host[:port]

Set the host (and port, if desired) for connecting to management server

All MySQL 5.7 based releases

--ndb-nodeid=#

Set node id for this node

All MySQL 5.7 based releases

--ndb-optimized-node-selection

Select nodes for transactions in a more optimal way

All MySQL 5.7 based releases

--version,

-V

Output version information and exit

All MySQL 5.7 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 .

  • --help, --usage, -?

    Command-Line Format--help
     --usage

    Prints a short list with descriptions of the available command options.

  • --character-sets-dir=name

    Command-Line Format--character-sets-dir=dir_name
    Permitted ValuesTypedirectory 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 ValuesTypestring
    Defaultlocalhost: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”.

  • --connect-retries=#

    Command-Line Format--connect-retries=#
    Permitted ValuesTypenumeric
    Default12
    Min Value0
    Max Value4294967295

    This option specifies the number of times following the first attempt to retry a connection before giving up (the client always tries the connection at least once). The length of time to wait per attempt is set using --connect-retry-delay.

    Note

    When used with ndb_mgm, this option has 3 as its default. See Section 6.5, “ndb_mgm — The NDB Cluster Management Client”, for more information.

  • --connect-retry-delay=#

    Command-Line Format--connect-retry-delay=#
    Permitted ValuesTypenumeric
    Default5
    Min Value0
    Max Value4294967295
    Permitted Values (>= 5.7.10-ndb-7.5.0)Typenumeric
    Default5
    Min Value1
    Max Value4294967295

    This option specifies the length of time to wait per attempt a connection before giving up. The number of times to try connecting is set by --connect-retries.

  • --core-file

    Command-Line Format--core-file
    Permitted ValuesTypeboolean
    DefaultFALSE

    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.

  • --debug[=options]

    Command-Line Format--debug=options
    Permitted ValuesTypestring
    Defaultd: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.

  • --ndb-mgmd-host=host[:port]

    Command-Line Format--ndb-mgmd-host=host[:port]
    Permitted ValuesTypestring
    Defaultlocalhost: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.

  • --ndb-nodeid=#

    Command-Line Format--ndb-nodeid=#
    Permitted ValuesTypenumeric
    Default0

    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 ValuesTypeboolean
    DefaultTRUE

    Optimize selection of nodes for transactions. Enabled by default.

  • --version, -V

    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.