17.4.7 ndb_config — Extract MySQL Cluster Configuration Information

This tool extracts current configuration information for data nodes, SQL nodes, and API nodes from one of a number of sources: a MySQL 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. Beginning with MySQL Cluster NDB 7.0.27 and MySQL Cluster NDB 7.1.16, it is also possible to use a data node as the source by specifying its node ID using --config_from_node=node_id.

Beginning with MySQL Cluster NDB 6.3.25 and MySQL Cluster NDB 7.0.6, 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).

Beginning with MySQL Cluster NDB 7.0.27 and MySQL Cluster NDB 7.1.16, 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 MySQL Cluster programs (including ndb_config), see Section 17.4.25, “Options Common to MySQL Cluster Programs — Options Common to MySQL Cluster Programs”.

Table 17.15  This table describes command-line options for the ndb_config program

Format Description Added or Removed

--nodes

Print node information (DB section) only.

All MySQL 5.1 based releases

--connections

Print CONNECTIONS section information only. Cannot be used with --nodes or --system option.

All MySQL 5.1 based releases

--query=string,

-q

One or more query options (attributes)

All MySQL 5.1 based releases

--host=name

Specify host

All MySQL 5.1 based releases

--type=name

Specify node type

All MySQL 5.1 based releases

--nodeid,

--id

Get configuration of node with this ID

All MySQL 5.1 based releases

--fields=string,

-f

Field separator

All MySQL 5.1 based releases

--rows=string,

-r

Row separator

All MySQL 5.1 based releases

--config-file=path

Set the path to config.ini file

All MySQL 5.1 based releases

--mycnf

Read configuration data from my.cnf file

All MySQL 5.1 based releases

-c

Short form for --ndb-connectstring

ADDED: 5.1.12

--configinfo

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

ADDED: NDB 6.3.25, NDB 7.0.6

--configinfo --xml

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

ADDED: NDB 6.3.25, NDB 7.0.6

--system

Print SYSTEM section information only. Cannot be used with --nodes or --connections option.

ADDED: NDB 7.0.27, NDB 7.1.16

--config_from_node=#

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

ADDED: NDB 7.0.27, NDB 7.1.16


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.