MySQL 8.0 Reference Manual Including MySQL NDB Cluster 8.0

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

All options that can be used with ndb_config are shown in the following table. Additional descriptions follow the table.

Table 25.29 Command-line options used with the program ndb_config

Format Description Added, Deprecated, or Removed

--character-sets-dir=path

Directory containing character sets

REMOVED: 8.0.31

--cluster-config-suffix=name

Override defaults group suffix when reading cluster_config sections in my.cnf file; used in testing

ADDED: NDB 8.0.24

--config-binary-file=path/to/file

Read this binary configuration file

ADDED: NDB 8.0.32

--config-file=file_name

Set the path to config.ini file

(Supported in all NDB releases based on MySQL 8.0)

--config-from-node=#

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

(Supported in all NDB releases based on MySQL 8.0)

--configinfo

Dumps information about all NDB configuration parameters in text format with default, maximum, and minimum values. Use with --xml to obtain XML output

(Supported in all NDB releases based on MySQL 8.0)

--connections

Print information only about connections specified in [tcp], [tcp default], [sci], [sci default], [shm], or [shm default] sections of cluster configuration file. Cannot be used with --system or --nodes

(Supported in all NDB releases based on MySQL 8.0)

--connect-retries=#

Number of times to retry connection before giving up

(Supported in all NDB releases based on MySQL 8.0)

--connect-retry-delay=#

Number of seconds to wait between attempts to contact management server

(Supported in all NDB releases based on MySQL 8.0)

--connect-string=connection_string,

-c connection_string

Same as --ndb-connectstring

(Supported in all NDB releases based on MySQL 8.0)

--core-file

Write core file on error; used in debugging

REMOVED: 8.0.31

--defaults-extra-file=path

Read given file after global files are read

(Supported in all NDB releases based on MySQL 8.0)

--defaults-file=path

Read default options from given file only

(Supported in all NDB releases based on MySQL 8.0)

--defaults-group-suffix=string

Also read groups with concat(group, suffix)

(Supported in all NDB releases based on MySQL 8.0)

--diff-default

Print only configuration parameters that have non-default values

(Supported in all NDB releases based on MySQL 8.0)

--fields=string,

-f

Field separator

(Supported in all NDB releases based on MySQL 8.0)

--help,

-?

Display help text and exit

(Supported in all NDB releases based on MySQL 8.0)

--host=name

Specify host

(Supported in all NDB releases based on MySQL 8.0)

--login-path=path

Read given path from login file

(Supported in all NDB releases based on MySQL 8.0)

--mycnf

Read configuration data from my.cnf file

(Supported in all NDB releases based on MySQL 8.0)

--ndb-connectstring=connection_string,

-c connection_string

Set connect string for connecting to ndb_mgmd. Syntax: "[nodeid=id;][host=]hostname[:port]". Overrides entries in NDB_CONNECTSTRING and my.cnf

(Supported in all NDB releases based on MySQL 8.0)

--ndb-mgmd-host=connection_string,

-c connection_string

Same as --ndb-connectstring

(Supported in all NDB releases based on MySQL 8.0)

--ndb-nodeid=#

Set node ID for this node, overriding any ID set by --ndb-connectstring

REMOVED: 8.0.31

--ndb-optimized-node-selection

Enable optimizations for selection of nodes for transactions. Enabled by default; use --skip-ndb-optimized-node-selection to disable

REMOVED: 8.0.31

--no-defaults

Do not read default options from any option file other than login file

(Supported in all NDB releases based on MySQL 8.0)

--nodeid=#

Get configuration of node with this ID

(Supported in all NDB releases based on MySQL 8.0)

--nodes

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

(Supported in all NDB releases based on MySQL 8.0)

--query=string,

-q string

One or more query options (attributes)

(Supported in all NDB releases based on MySQL 8.0)

--query-all,

-a

Dumps all parameters and values to a single comma-delimited string

(Supported in all NDB releases based on MySQL 8.0)

--print-defaults

Print program argument list and exit

(Supported in all NDB releases based on MySQL 8.0)

--rows=string,

-r string

Row separator

(Supported in all NDB releases based on MySQL 8.0)

--system

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

(Supported in all NDB releases based on MySQL 8.0)

--type=name

Specify node type

(Supported in all NDB releases based on MySQL 8.0)

--usage,

-?

Display help text and exit; same as --help

(Supported in all NDB releases based on MySQL 8.0)

--version,

-V

Display version information and exit

(Supported in all NDB releases based on MySQL 8.0)

--configinfo --xml

Use --xml with --configinfo to obtain a dump of all NDB configuration parameters in XML format with default, maximum, and minimum values

(Supported in all NDB releases based on MySQL 8.0)


Combining other ndb_config options (such as --query or --type) with --configinfo (with or without the --xml option 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:

    $> ./ndb_config --query=nodeid,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:

    $> ./ndb_config --config-file=usr/local/mysql/cluster-data/config.ini \
    --query=hostname,portnumber --fields=: --rows=, --type=ndb_mgmd
    198.51.100.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 and DataDir parameters:

    $> ./ndb_config --type=ndbd --query=nodeid,host,datamemory,datadir -f ' : ' -r '\n'
    1 : 198.51.100.193 : 83886080 : /usr/local/mysql/cluster-data
    2 : 198.51.100.112 : 83886080 : /usr/local/mysql/cluster-data
    3 : 198.51.100.176 : 83886080 : /usr/local/mysql/cluster-data
    4 : 198.51.100.119 : 83886080 : /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, as well as the short option -q to pass a list of parameters to be obtained.

  4. To exclude results from any host except one in particular, use the --host option:

    $> ./ndb_config --host=198.51.100.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 --nodeid option.