该工具从多个来源之一提取数据节点、SQL 节点和 API 节点的当前配置信息:NDB Cluster 管理节点,或其 config.ini 或 my.cnf 文件。默认情况下,管理节点是配置数据的来源;要覆盖默认设置,请使用 --config-file 或 --mycnf 选项执行 ndb_config。也可以通过使用数据节点作为来源,通过指定其节点 ID 并使用 --config_from_node= 来实现。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
node_idconfig.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 还可以提供所有配置参数的离线转储,这些转储可与其默认值、最大值、最小值及其他信息一起使用。转储可以以文本或 XML 格式生成;有关更多信息,请参阅本节后面关于 --configinfo 和 --xml 选项的讨论。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).
您可以使用以下选项之一 --nodes、--system 或 --connections 按部分(DB、SYSTEM 或 CONNECTIONS)筛选结果。You can filter the results by section (DB,
SYSTEM, or CONNECTIONS)
using one of the options
--nodes,
--system, or
--connections.
可以与 ndb_config 一起使用的所有选项显示在下表中。表格后面有附加说明。All options that can be used with ndb_config are shown in the following table. Additional descriptions follow the table.
命令行格式Command-Line Format --character-sets-dir=path--character-sets-dir=path包含字符集的目录。Directory containing character sets.
命令行格式Command-Line Format --cluster-config-suffix=name类型Type 字符串String 默认值Default Value [none][none]在读取
my.cnf中的集群配置部分时覆盖默认的组后缀;用于测试。Override defaults group suffix when reading cluster configuration sections inmy.cnf; used in testing.--configinfo选项会使 ndb_config 输出 NDB Cluster 分发版所支持的每个 NDB Cluster 配置参数的列表,ndb_config 就是该分发版的一部分,包括以下信息:The--configinfooption causes ndb_config to dump a list of each NDB Cluster configuration parameter supported by the NDB Cluster distribution of which ndb_config is a part, including the following information:每个参数用途、效果和使用方法的简要说明A brief description of each parameter's purpose, effects, and usage
参数可使用的
config.ini文件部分The section of theconfig.inifile 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
NDB 集群版本和构建信息NDB Cluster release version and build information
默认情况下,此输出为文本格式。此处显示了部分输出:By default, this output is in text format. Part of this output is shown here:
$>
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) …将此选项与
--xml选项一起使用,以获取 XML 格式的输出。Use this option together with the--xmloption to obtain output in XML format.--config-binary-file=path-to-file--config-binary-file=path-to-file命令行格式Command-Line Format --config-binary-file=path/to/file--config-binary-file=path/to/file类型Type 文件名File name 默认值Default Value 提供到管理服务器缓存的二进制配置文件的路径(
ndb_)。这可以是相对路径或绝对路径。如果管理服务器和使用的 ndb_config 二进制文件位于不同主机上,则必须使用绝对路径。Gives the path to the management server's cached binary configuration file (nodeID_config.bin.seqnondb_). This may be a relative or absolute path. If the management server and the ndb_config binary used reside on different hosts, you must use an absolute path.nodeID_config.bin.seqno此示例演示了如何将
--config-binary-file与其他 ndb_config 选项结合使用以获取有用的输出:This example demonstrates combining--config-binary-filewith other ndb_config options to obtain useful output:$>
ndb_config --config-binary-file=../mysql-cluster/ndb_50_config.bin.1 --diff-default --type=ndbdconfig 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 --systemconfig of [SYSTEM] system CONFIG_PARAMETER,ACTUAL_VALUE,DEFAULT_VALUE Name,MC_20220906060042,(mandatory) ConfigGenerationNumber,1,0 PrimaryMGMNode,50,0以下显示了
config.ini文件的相关部分:The relevant portions of theconfig.inifile 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.
--config-file=path-to-file--config-file=path-to-file命令行格式Command-Line Format --config-file=file_name类型Type 文件名File name 默认值Default Value 提供集群配置文件的路径(
config.ini)。这可以是相对路径或绝对路径。如果管理服务器和使用的 ndb_config 二进制文件位于不同主机上,则必须使用绝对路径。Gives the path to the cluster configuration file (config.ini). This may be a relative or absolute path. If the management server and the ndb_config binary used reside on different hosts, you must use an absolute path.命令行格式Command-Line Format --config-from-node=#类型Type 数字Numeric 默认值Default Value nonenone最小值Minimum Value 1最大值Maximum Value 48从具有该 ID 的数据节点获取集群的配置信息。Obtain the cluster's configuration data from the data node that has this ID.
如果具有此 ID 的节点不是数据节点,ndb_config 将报错。(如果想从管理节点获取配置数据,只需省略此选项。)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 --connect-retries=#类型Type 整数Integer 默认值Default Value 12最小值Minimum Value 0最大值Maximum Value 12放弃之前重试连接的次数。Number of times to retry connection before giving up.
命令行格式Command-Line Format --connect-retry-delay=#类型Type 整数Integer 默认值Default Value 5最小值Minimum Value 0最大值Maximum Value 5尝试联系管理服务器之间等待的秒数。Number of seconds to wait between attempts to contact management server.
命令行格式Command-Line Format --connect-string=connection_string类型Type 字符串String 默认值Default Value [none][none]与
--ndb-connectstring相同。Same as--ndb-connectstring.命令行格式Command-Line Format --connections告诉 ndb_config 仅打印
CONNECTIONS信息——也就是关于在集群配置文件的[tcp]、[tcp default]、[shm]或[shm default]部分中找到的参数的信息(更多信息请参见 第 25.4.3.10 节,“NDB 集群 TCP/IP 连接” 和 第 25.4.3.12 节,“NDB 集群共享内存连接”)。Tells ndb_config to printCONNECTIONSinformation only—that is, information about parameters found in the[tcp],[tcp default],[shm], or[shm default]sections of the cluster configuration file (see Section 25.4.3.10, “NDB Cluster TCP/IP Connections”, and Section 25.4.3.12, “NDB Cluster Shared-Memory Connections”, for more information).此选项与
--nodes和--system互斥;这三者中只能使用其中一个选项。This option is mutually exclusive with--nodesand--system; only one of these 3 options can be used.命令行格式Command-Line Format --core-file错误时生成核心文件;用于调试。Write core file on error; used in debugging.
命令行格式Command-Line Format --defaults-extra-file=path--defaults-extra-file=path类型Type 字符串String 默认值Default Value [none][none]在读取全局文件之后读取给定文件。Read given file after global files are read.
命令行格式Command-Line Format --defaults-file=path类型Type 字符串String 默认值Default Value [none][none]仅从指定文件读取默认选项。Read default options from given file only.
命令行格式Command-Line Format --defaults-group-suffix=string类型Type 字符串String 默认值Default Value [none][none]也读取组合了 concat(group, suffix) 的组。Also read groups with concat(group, suffix).
命令行格式Command-Line Format --diff-default仅打印具有非默认值的配置参数。Print only configuration parameters that have non-default values.
--fields=,delimiter-fdelimiter命令行格式Command-Line Format --fields=string类型Type 字符串String 默认值Default Value 指定用于分隔结果中字段的
delimiter字符串。默认值是,(逗号字符)。Specifies adelimiterstring used to separate the fields in the result. The default is,(the comma character).Note如果
delimiter包含空格或转义字符(例如用于换行符的\n),则必须加引号。If thedelimitercontains spaces or escapes (such as\nfor the linefeed character), then it must be quoted.命令行格式Command-Line Format --help--help显示帮助文本并退出。Display help text and exit.
--host=hostname--host=hostname命令行格式Command-Line Format --host=name类型Type 字符串String 默认值Default Value 指定要获取配置信息的节点的主机名。Specifies the host name of the node for which configuration information is to be obtained.
Note虽然主机名
localhost通常会解析为 IP 地址127.0.0.1,但对于所有操作平台和配置而言,这不一定成立。这意味着,当localhost在config.ini中使用时,ndb_config--host=localhost可能会失败,如果ndb_config在不同主机上运行localhostresolves to a different address (for example, on some versions of SUSE Linux, this is127.0.0.2). In general, for best results, you should use numeric IP addresses for all NDB Cluster configuration values relating to hosts, or verify that all NDB Cluster hosts handlelocalhostin the same fashion.While the hostnamelocalhostusually resolves to the IP address127.0.0.1, this may not necessarily be true for all operating platforms and configurations. This means that it is possible, whenlocalhostis used inconfig.ini, for ndb_config--host=localhostto fail if ndb_config is run on a different host wherelocalhostresolves to a different address (for example, on some versions of SUSE Linux, this is127.0.0.2). In general, for best results, you should use numeric IP addresses for all NDB Cluster configuration values relating to hosts, or verify that all NDB Cluster hosts handlelocalhostin the same fashion.命令行格式Command-Line Format --login-path=path类型Type 字符串String 默认值Default Value [none][none]从登录文件读取给定路径。Read given path from login file.
命令行格式Command-Line Format --mycnf从
my.cnf文件读取配置数据。Read configuration data from themy.cnffile.--ndb-connectstring=,connection_string-cconnection_string命令行格式Command-Line Format --ndb-connectstring=connection_string类型Type 字符串String 默认值Default Value [none][none]指定用于连接管理服务器的连接字符串。连接字符串的格式与第 25.4.3.3 节,“NDB 集群连接字符串”中描述的格式相同,默认值为
localhost: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 25.4.3.3, “NDB Cluster Connection Strings”, and defaults tolocalhost:1186.命令行格式Command-Line Format --ndb-mgm-tls=level类型Type 枚举Enumeration 默认值Default Value relaxedrelaxed有效值Valid Values relaxedrelaxedstrictstrict设置连接到管理服务器所需的 TLS 支持级别;可以是
relaxed或strict。relaxed(默认)表示尝试建立 TLS 连接,但不要求成功;strict表示连接必须使用 TLS。Sets the level of TLS support required to connect to the management server; one ofrelaxedorstrict.relaxed(the default) means that a TLS connection is attempted, but success is not required;strictmeans that TLS is required to connect.命令行格式Command-Line Format --ndb-mgmd-host=connection_string类型Type 字符串String 默认值Default Value [none][none]与
--ndb-connectstring相同。Same as--ndb-connectstring.命令行格式Command-Line Format --ndb-nodeid=#类型Type 整数Integer 默认值Default Value [none][none]为此节点设置节点 ID,覆盖由
--ndb-connectstring设置的任何 ID。Set node ID for this node, overriding any ID set by--ndb-connectstring.--ndb-optimized-node-selection命令行格式Command-Line Format --ndb-optimized-node-selection启用事务节点选择的优化。默认启用;使用
--skip-ndb-optimized-node-selection来禁用。Enable optimizations for selection of nodes for transactions. Enabled by default; use--skip-ndb-optimized-node-selectionto disable.命令行格式Command-Line Format --ndb-tls-search-path=list类型Type 路径名Path name 默认值(Unix)Default Value (Unix) $HOME/ndb-tls$HOME/ndb-tls默认值(Windows)Default Value (Windows) $HOMEDIR/ndb-tls指定用于搜索 CA 文件的目录列表。在 Unix 平台上,目录名称用冒号 (
:) 分隔;在 Windows 系统上,使用分号 (;) 作为分隔符。目录引用可以是相对路径或绝对路径;它可以包含一个或多个环境变量,每个变量以美元符号 ($) 开头,并在使用前进行展开。Specify a list of directories to search for a CA file. On Unix platforms, the directory names are separated by colons (:); on Windows systems, the semicolon character (;) is used as the separator. A directory reference may be relative or absolute; it may contain one or more environment variables, each denoted by a prefixed dollar sign ($), and expanded prior to use.搜索从最左边的命名目录开始,按从左到右的顺序进行,直到找到文件。空字符串表示空搜索路径,这会导致所有搜索失败。由单个点 (
.) 组成的字符串表示搜索路径仅限于当前工作目录。Searching begins with the leftmost named directory and proceeds from left to right until a file is found. An empty string denotes an empty search path, which causes all searches to fail. A string consisting of a single dot (.) indicates that the search path limited to the current working directory.如果未提供搜索路径,则使用编译时的默认值。此值取决于所使用的平台:在 Windows 上,它是
\ndb-tls;在其他平台(包括 Linux)上,它是$HOME/ndb-tls。可以通过使用-DWITH_NDB_TLS_SEARCH_PATH编译 NDB Cluster 来覆盖该值。If no search path is supplied, the compiled-in default value is used. This value depends on the platform used: On Windows, this is\ndb-tls; on other platforms (including Linux), it is$HOME/ndb-tls. This can be overridden by compiling NDB Cluster using-DWITH_NDB_TLS_SEARCH_PATH.命令行格式Command-Line Format --no-defaults--no-defaults除了登录文件之外,不从任何配置文件读取默认选项。Do not read default options from any option file other than login file.
命令行格式Command-Line Format --no-login-paths跳过从登录路径文件读取选项。Skips reading options from the login path file.
命令行格式Command-Line Format --ndb-nodeid=#类型Type 整数Integer 默认值Default Value [none][none]指定要获取配置信息的节点的节点 ID。Specify the node ID of the node for which configuration information is to be obtained.
命令行格式Command-Line Format --nodes告诉 ndb_config 打印仅与集群配置文件中的
[ndbd]或[ndbd default]部分定义的参数相关的信息(参见 第 25.4.3.6 节,“定义 NDB 集群数据节点”)。Tells ndb_config to print information relating only to parameters defined in an[ndbd]or[ndbd default]section of the cluster configuration file (see Section 25.4.3.6, “Defining NDB Cluster Data Nodes”).该选项与
--connections和--system互斥;这三个选项中只能使用其中一个。This option is mutually exclusive with--connectionsand--system; only one of these 3 options can be used.命令行格式Command-Line Format --print-defaults打印程序参数列表然后退出。Print program argument list and exit.
--query=query-options,-qquery-options--query=,query-options-qquery-options命令行格式Command-Line Format --query=string--query=string类型Type 字符串String 默认值Default Value 这是一个以逗号分隔的查询选项列表——也就是要返回的一个或多个节点属性的列表。这些包括
nodeid(节点 ID)、type(节点类型——即ndbd、mysqld或ndb_mgmd)以及任何需要获取其值的配置参数。This is a comma-delimited list of query options—that is, a list of one or more node attributes to be returned. These includenodeid(node ID), type (node type—that is,ndbd,mysqld, orndb_mgmd), and any configuration parameters whose values are to be obtained.例如,
--query=nodeid,type,datamemory,datadir为每个节点返回节点 ID、节点类型、DataMemory和DataDir。For example,--query=nodeid,type,datamemory,datadirreturns the node ID, node type,DataMemory, andDataDirfor 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.
--query-all,-a命令行格式Command-Line Format --query-all类型Type 字符串String 默认值Default Value 返回所有查询选项(节点属性)的逗号分隔列表;注意,该列表是单个字符串。Returns a comma-delimited list of all query options (node attributes; note that this list is a single string.
--rows=,separator-rseparator命令行格式Command-Line Format --rows=string类型Type 字符串String 默认值Default Value 指定用于分隔结果行的
separator字符串。默认是空格字符。Specifies aseparatorstring used to separate the rows in the result. The default is a space character.Note如果
separator包含空格或转义字符(例如用于换行的\n),则必须加引号。If theseparatorcontains spaces or escapes (such as\nfor the linefeed character), then it must be quoted.命令行格式Command-Line Format --system告诉ndb_config只打印
SYSTEM信息。这包括运行时无法更改的系统变量,因此在集群配置文件中没有对应的部分。它们可以在ndb_config--configinfo的输出中看到(前缀为****** SYSTEM ******)。Tells ndb_config to printSYSTEMinformation only. This consists of system variables that cannot be changed at run time; thus, there is no corresponding section of the cluster configuration file for them. They can be seen (prefixed with****** SYSTEM ******) in the output of ndb_config--configinfo.此选项与
--nodes和--connections互斥;这三个选项中只能使用一个。This option is mutually exclusive with--nodesand--connections; only one of these 3 options can be used.命令行格式Command-Line Format --type=name类型Type 枚举Enumeration 默认值Default Value [none][none]有效值Valid Values ndbdmysqldmysqldndb_mgmd筛选结果,仅返回适用于指定
node_type(ndbd、mysqld或ndb_mgmd)节点的配置值。Filters results so that only configuration values applying to nodes of the specifiednode_type(ndbd,mysqld, orndb_mgmd) are returned.--usage,--help,或-?--usage,--help, or-?命令行格式Command-Line Format --help--help使 ndb_config 打印可用选项列表,然后退出。Causes ndb_config to print a list of available options, and then exit.
--version,-V命令行格式Command-Line Format --version导致 ndb_config 打印版本信息字符串,然后退出。Causes ndb_config to print a version information string, and then exit.
--configinfo--xml命令行格式Command-Line Format --configinfo --xml通过添加此选项,可以使 ndb_config
--configinfo以 XML 格式输出。此示例显示了部分输出:Cause ndb_config--configinfoto provide output as XML by adding this option. A portion of such output is shown in this example:$>
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通常,由 ndb_config
--configinfo--xml生成的 XML 输出是每个元素一行的格式;在前面的示例以及下一个示例中,我们为了可读性添加了额外的空白。这对使用该输出的应用程序不应有影响,因为大多数 XML 处理器通常会忽略非必要的空白,或者可以被指示忽略这些空白。Normally, the XML output produced by ndb_config--configinfo--xmlis 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.XML 输出还会指示在更改给定参数时是否需要使用
--initial选项重新启动数据节点。如在相应的<param>元素中存在initial="true"属性所示。此外,还会显示重启类型(system或node);如果某个参数需要系统重启,则在相应的<param>元素中会显示restart="system"属性。例如,更改Diskless参数的值需要系统初始重启,如下所示(突出显示了restart和initial属性以便查看):The XML output also indicates when changing a given parameter requires that data nodes be restarted using the--initialoption. This is shown by the presence of aninitial="true"attribute in the corresponding<param>element. In addition, the restart type (systemornode) is also shown; if a given parameter requires a system restart, this is indicated by the presence of arestart="system"attribute in the corresponding<param>element. For example, changing the value set for theDisklessparameter requires a system initial restart, as shown here (with therestartandinitialattributes highlighted for visibility):<param name="Diskless" comment="Run wo/ disk" type="bool" default="false" restart="system" initial="true"/>Currently, no
initialattribute 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 valuefalseshould be assumed if the attribute is not present. Similarly, the default restart type isnode(that is, an online or “rolling” restart of the cluster), but therestartattribute is included only if the restart type issystem(meaning that all cluster nodes must be shut down at the same time, then restarted).弃用参数在 XML 输出中通过
deprecated属性表示,如下所示:Deprecated parameters are indicated in the XML output by thedeprecatedattribute, as shown here:<param name="NoOfDiskPagesToDiskAfterRestartACC" comment="DiskCheckpointSpeed" type="unsigned" default="20" min="1" max="4294967039" deprecated="true"/>在这种情况下,
comment指的是一个或多个取代已弃用参数的参数。与initial类似,deprecated属性仅在参数被弃用时显示,即deprecated="true",对于未弃用的参数则根本不会出现该属性。(Bug #21127135)In such cases, thecommentrefers to one or more parameters that supersede the deprecated parameter. Similarly toinitial, thedeprecatedattribute is indicated only when the parameter is deprecated, withdeprecated="true", and does not appear at all for parameters which are not deprecated. (Bug #21127135)必须的参数用
mandatory="true"表示,如下所示: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"/>就像
initial或deprecated属性仅显示在需要初始重启或已弃用的参数上一样,mandatory属性仅在给定参数确实是必需时才包含。In much the same way that theinitialordeprecatedattribute is displayed only for a parameter that requires an initial restart or that is deprecated, themandatoryattribute is included only if the given parameter is actually required.Important--xml选项只能与--configinfo选项一起使用。在没有--configinfo的情况下使用--xml会导致错误。The--xmloption can be used only with the--configinfooption. Using--xmlwithout--configinfofails with an error.与用于获取当前配置数据的该程序的其他选项不同,
--configinfo和--xml使用在编译 ndb_config 时从 NDB Cluster 来源获取的信息。因此,这两个选项不需要连接到正在运行的 NDB Cluster,也不需要访问config.ini或my.cnf文件。Unlike the options used with this program to obtain current configuration data,--configinfoand--xmluse 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 aconfig.iniormy.cnffile is required for these two options.
将其他 ndb_config 选项(例如 --query 或 --type)与 --configinfo(无论是否使用 --xml 选项)结合使用是不支持的。目前,如果尝试这样做,通常的结果是除了 --configinfo 或 --xml 之外的所有其他选项都会被简单忽略。然而,此行为不保证,并可能随时更改。此外,由于 ndb_config 在与 --configinfo 选项一起使用时,不会访问 NDB 集群或读取任何文件,因此尝试在 --configinfo 中指定诸如 --ndb-connectstring 或 --config-file 等附加选项是没有意义的。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
获取集群中每个节点的节点 ID 和类型: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在此示例中,我们使用
--fields选项,用冒号字符 (:) 分隔每个节点的 ID 和类型,并使用--rows选项,将每个节点的值放在输出的新行上。In this example, we used the--fieldsoptions to separate the ID and type of each node with a colon character (:), and the--rowsoptions to place the values for each node on a new line in the output.生成可供数据节点、SQL 节点和 API 节点连接管理服务器使用的连接字符串: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_mgmd198.51.100.179:1186此调用 ndb_config 仅检查数据节点(使用
--type选项),并显示每个节点的 ID 和主机名的值,以及其DataMemory和DataDir参数设置的值:This invocation of ndb_config checks only data nodes (using the--typeoption), and shows the values for each node's ID and host name, as well as the values set for itsDataMemoryandDataDirparameters:$>
./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在此示例中,我们使用了短选项
-f和-r分别设置字段分隔符和行分隔符,以及短选项-q来传递要获取的参数列表。In this example, we used the short options-fand-rfor setting the field delimiter and row separator, respectively, as well as the short option-qto pass a list of parameters to be obtained.要排除除特定主机之外的所有主机的结果,请使用
--host选项:To exclude results from any host except one in particular, use the--hostoption:$>
./ndb_config --host=198.51.100.176 -f : -r '\n' -q id,type3:ndbd 5:ndb_mgmd在此示例中,我们还使用了短形式
-q来确定要查询的属性。In this example, we also used the short form-qto determine the attributes to be queried.同样,您可以使用
--nodeid选项将结果限制为具有特定 ID 的节点。Similarly, you can limit results to a node with a specific ID using the--nodeidoption.