25.5.7 ndb_config — Extract NDB Cluster Configuration Information (original) (raw)

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

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

Use this option together with the--xml option to obtain output in XML format.

$> ndb_config --config-binary-file=../mysql-cluster/ndb_50_config.bin.1 --diff-default --type=ndbd  
config of [DB] node id 5 that is different from default  
CONFIG_PARAMETER,ACTUAL_VALUE,DEFAULT_VALUE  
NodeId,5,(mandatory)  
BackupDataDir,/local/data/8.4,(null)  
DataDir,/local/data/8.4,.  
DataMemory,2G,98M  
FileSystemPath,/local/data/8.4,(null)  
HostName,127.0.0.1,localhost  
Nodegroup,0,(null)  
ThreadConfig,,(null)  
config of [DB] node id 6 that is different from default  
CONFIG_PARAMETER,ACTUAL_VALUE,DEFAULT_VALUE  
NodeId,6,(mandatory)  
BackupDataDir,/local/data/8.4,(null)  
DataDir,/local/data/8.4.  
DataMemory,2G,98M  
FileSystemPath,/local/data/8.4,(null)  
HostName,127.0.0.1,localhost  
Nodegroup,0,(null)  
ThreadConfig,,(null)  
$> ndb_config --config-binary-file=../mysql-cluster/ndb_50_config.bin.1 --diff-default --system  
config of [SYSTEM] system  
CONFIG_PARAMETER,ACTUAL_VALUE,DEFAULT_VALUE  
Name,MC_20220906060042,(mandatory)  
ConfigGenerationNumber,1,0  
PrimaryMGMNode,50,0  

The relevant portions of the config.ini file are shown here:

[ndbd default]  
DataMemory= 2G  
NoOfReplicas= 2  
[ndb_mgmd]  
NodeId= 50  
HostName= 127.0.0.1  
[ndbd]  
NodeId= 5  
HostName= 127.0.0.1  
DataDir= /local/data/8.4  
[ndbd]  
NodeId= 6  
HostName= 127.0.0.1  
DataDir= /local/data/8.4  

By comparing the output with the configuration file, you can see that all of the settings in the file have been written by the management server to the binary cache, and thus, applied to the cluster.

$> ndb_config --configinfo --xml  
<configvariables protocolversion="1" ndbversionstring="5.7.44-ndb-7.5.36"  
                    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 byndb_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 ornode) 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 theDiskless parameter requires a system initial restart, as shown here (with therestart 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 therestart 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 thedeprecated attribute, as shown here:

<param name="NoOfDiskPagesToDiskAfterRestartACC" comment="DiskCheckpointSpeed"  
       type="unsigned" default="20" min="1" max="4294967039" deprecated="true"/>  

In such cases, the comment refers to one or more parameters that supersede the deprecated parameter. Similarly to initial, thedeprecated attribute is indicated only when the parameter is deprecated, withdeprecated="true", and does not appear at all for parameters which are not deprecated. (Bug #21127135)
Parameters that are required are indicated withmandatory="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 ordeprecated attribute is displayed only for a parameter that requires an initial 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 ormy.cnf file is required for these two options.

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