MySQL 5.0 Reference Manual  /  ...  /  ndb_config — Extract MySQL Cluster Configuration Information

17.4.4 ndb_config — Extract MySQL Cluster Configuration Information

This tool extracts configuration information for data nodes, SQL nodes, and API nodes from a cluster management node (and possibly its config.ini file).

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

Table 17.29 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.0 based releases

--query=string,

-q

One or more query options (attributes)

All MySQL 5.0 based releases

--host=name

Specify host

All MySQL 5.0 based releases

--type=name

Specify node type

All MySQL 5.0 based releases

--nodeid,

--id

Get configuration of node with this ID

All MySQL 5.0 based releases

--fields=string,

-f

Field separator

All MySQL 5.0 based releases

--rows=string,

-r

Row separator

All MySQL 5.0 based releases

--config-file=file_name

Set the path to config.ini file

All MySQL 5.0 based releases

--mycnf

Read configuration data from my.cnf file

All MySQL 5.0 based releases

-c

Short form for --ndb-connectstring

ADDED: 5.0.33


Table 17.30 ndb_config Command Line Options

FormatDescriptionIntroduced
--config-fileSet the path to config.ini file
--fieldsField separator
--hostSpecify host
--mycnfRead configuration data from my.cnf file
--id, --nodeidGet configuration of node with this ID
--nodesPrint node information ([ndbd] or [ndbd default] section of cluster configuration file) only. Cannot be used with --system or --connections.
-cShort form for --ndb-connectstring5.0.33
--queryOne or more query options (attributes)
--rowsRow separator
--typeSpecify node type

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

    Command-Line Format--help
    --usage

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

  • --version, -V

    Command-Line Format--version

    Causes ndb_config to print a version information string, and then exit.

  • --ndb-connectstring=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 17.3.3.2, “MySQL Cluster Connection Strings”, and defaults to localhost:1186.

    The use of -c as a short version for this option is supported for ndb_config beginning with MySQL 5.0.29.

  • --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 MySQL Clustewr configuration values relating to hosts, or verify that all MySQL 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

    In MySQL 5.0, this option has no affect.

  • --connections

    This option (not listed in the table) is present but has no affect in MySQL 5.0. It is reserved for use in a future version of MySQL Cluster.

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

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


User Comments
Sign Up Login You must be logged in to post a comment.