Spec-Zone .ru
спецификации, руководства, описания, API
|
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. 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 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.14. ndb_config Options and Variables: MySQL Cluster NDB7.3
Format | Description | Added / Removed |
---|---|---|
Print node information (DB section) only. | All MySQL 5.6 based releases |
|
Print CONNECTIONS section information only. Cannot be used with --nodes or --system option. | All MySQL 5.6 based releases |
|
One or more query options (attributes) | All MySQL 5.6 based releases |
|
Specify host | All MySQL 5.6 based releases |
|
Specify node type | All MySQL 5.6 based releases |
|
Get configuration of node with this ID | All MySQL 5.6 based releases |
|
Field separator | All MySQL 5.6 based releases |
|
Row separator | All MySQL 5.6 based releases |
|
Set the path to config.ini file | All MySQL 5.6 based releases |
|
Read configuration data from my.cnf file | All MySQL 5.6 based releases |
|
Short form for --ndb-connectstring | All MySQL 5.6 based releases |
|
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.6 based releases |
|
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.6 based releases |
|
Print SYSTEM section information only. Cannot be used with --nodes or --connections option. | All MySQL 5.6 based releases |
|
Obtain configuration data from the node having this ID (must be a data node). | All MySQL 5.6 based releases |
Command-Line Format | --help |
||
--usage |
|||
-? |
Causes ndb_config to print a list of available options, and then exit.
Command-Line Format | --config_from_node=# |
||
Permitted Values | |||
Type | numeric |
||
Default | none |
||
Range | 1 .. 48 |
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.)
Command-Line Format | --version |
||
-V |
Causes ndb_config to print a version information string, and then exit.
--ndb-connectstring=
, connect_string
-c
connect_string
Command-Line Format | --ndb-connectstring=connectstring |
||
--connect-string=connectstring |
|||
-c |
|||
Permitted Values | |||
Type | string |
||
Default | localhost:1186 |
Specifies the connectstring to use in connecting to the management server. The format for the
connectstring is the same as described in Section
17.3.2.3, "The MySQL Cluster Connectstring", and defaults to localhost:1186
.
Command-Line Format | --config-file=path |
||
Permitted Values | |||
Type | file 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.
Command-Line Format | --mycnf |
||
Permitted Values | |||
Type | boolean |
||
Default | FALSE |
Read configuration data from the my.cnf
file.
--query=
, query-options
-q
query-options
Command-Line Format | --query=string |
||
-q |
|||
Permitted Values | |||
Type | string |
||
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.
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.
Command-Line Format | --host=name |
||
Permitted Values | |||
Type | string |
||
Default |
|
Specifies the host name of the node for which configuration information is to be obtained.
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 Cluster configuration values relating
to hosts, or verify that all MySQL Cluster hosts handle localhost
in the same fashion.
Command-Line Format | --ndb-nodeid=# |
||
Permitted Values | |||
Type | numeric |
||
Default | 0 |
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.
Command-Line Format | --nodes |
||
Permitted Values | |||
Type | boolean |
||
Default | FALSE |
Tells ndb_config to print information from parameters
defined in DB
sections only. This option cannot be used together with
--connections
or --system
.
Command-Line Format | --connections |
||
Permitted Values | |||
Type | boolean |
||
Default | FALSE |
Tells ndb_config to print CONNECTIONS
information only. This option cannot be used together with --nodes
or --system
.
Command-Line Format | --system |
||
Permitted Values | |||
Type | boolean |
||
Default | FALSE |
Tells ndb_config to print SYSTEM
information only.
This option cannot be used together with the --nodes
or --system
options.
Command-Line Format | --type=name |
||
Permitted Values | |||
Type | enumeration |
||
Default |
|
||
Valid Values | ndbd |
||
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 |
||
-f |
|||
Permitted Values | |||
Type | string |
||
Default |
|
Specifies a delimiter
string used to separate the fields
in the result. The default is ",
" (the comma character).
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 |
||
-r |
|||
Permitted Values | |||
Type | string |
||
Default |
|
Specifies a separator
string used to separate the rows in
the result. The default is a space character.
If the separator
contains spaces or escapes
(such as \n
for the linefeed character), then it must be quoted.
The --configinfo
option causes ndb_config to dump a list of each MySQL Cluster
configuration parameter supported by the MySQL 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
A brief description of the parameter's purpose, effects, and usage
MySQL 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)MANDATORYPrimaryMGMNode (Non-negative Integer)Node id of Primary ndb_mgmd(MGM) nodeDefault: 0 (Min: 0, Max: 4294967039)ConfigGenerationNumber (Non-negative Integer)Configuration generation numberDefault: 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)…
Command-Line Format | --configinfo --xml |
||
Permitted Values | |||
Type | boolean |
||
Default | false |
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.6.11-ndb-7.3.3" ndbversion="458758" ndbversionmajor="7" ndbversionminor="0" ndbversionbuild="6"> <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="NDBD"> <param name="MaxNoOfSubscriptions" comment="Max no of subscriptions (default 0 == MaxNoOfTables)" type="unsigned" default="0" min="0" max="4294967039"/> <param name="MaxNoOfSubscribers" comment="Max no of subscribers (default 0 == 2 * MaxNoOfTables)" type="unsigned" default="0" min="0" max="4294967039"/> … </section> …</configvariables>
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).
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 MySQL Cluster sources when ndb_config was compiled. For this reason, no
connection to a running MySQL 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 MySQL Cluster or read any
files, trying to specify additional options such as --ndb-connectstring
or --config-file
with --configinfo
serves no
purpose.
To obtain the node ID and type of each node in the cluster:
shell> ./ndb_config --query=id,type
--fields=':' --rows='\n'
1:ndbd2:ndbd3:ndbd4:ndbd5:ndb_mgmd6:mysqld7:mysqld8:mysqld9: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.
To produce a connectstring 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
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-data2 : 192.168.0.112 : 83886080 : 18874368 : /usr/local/mysql/cluster-data3 : 192.168.0.176 : 83886080 : 18874368 : /usr/local/mysql/cluster-data4 : 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.
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:ndbd5: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.