文档首页
MySQL 8.4 参考手册
8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

MySQL 8.4 参考手册 / 25 MySQL NDB 集群 8.4 / 25.5 NDB 集群程序 / 25.5.31 ndb_waiter — 等待 NDB Cluster 达到给定状态
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 76%

25.5.31 ndb_waiter — 等待 NDB 集群达到指定状态25.5.31 ndb_waiter — Wait for NDB Cluster to Reach a Given Status

ndb_waiter 以每 100 毫秒为间隔重复打印所有集群数据节点的状态,直到集群达到指定状态或--timeout 限制被超过,然后退出。默认情况下,它会等待集群达到 STARTED 状态,此时所有节点已启动并连接到集群。可以使用 --no-contact 和 --not-started 选项覆盖此默认设置。ndb_waiter repeatedly (each 100 milliseconds) prints out the status of all cluster data nodes until either the cluster reaches a given status or the --timeout limit is exceeded, then exits. By default, it waits for the cluster to achieve STARTED status, in which all nodes have started and connected to the cluster. This can be overridden using the --no-contact and --not-started options.

该工具报告的节点状态如下:The node states reported by this utility are as follows:

  • NO_CONTACT:无法联系该节点。NO_CONTACT: The node cannot be contacted.

  • UNKNOWN:可以联系该节点,但其状态尚不清楚。通常,这意味着节点已收到来自管理服务器的START或RESTART命令,但尚未执行。UNKNOWN: The node can be contacted, but its status is not yet known. Usually, this means that the node has received a START or RESTART command from the management server, but has not yet acted on it.

  • NOT_STARTED:节点已停止,但仍与集群保持联系。当使用管理客户端的RESTART命令重新启动节点时会出现此情况。NOT_STARTED: The node has stopped, but remains in contact with the cluster. This is seen when restarting the node using the management client's RESTART command.

  • STARTING:节点的 ndbd 进程已启动,但节点尚未加入集群。STARTING: The node's ndbd process has started, but the node has not yet joined the cluster.

  • STARTED:节点已运行,并已加入集群。STARTED: The node is operational, and has joined the cluster.

  • SHUTTING_DOWN:节点正在关闭。SHUTTING_DOWN: The node is shutting down.

  • SINGLE USER MODE:当集群处于单用户模式时,所有集群数据节点都会显示此状态。SINGLE USER MODE: This is shown for all cluster data nodes when the cluster is in single user mode.

可以与 ndb_waiter 一起使用的选项显示在下表中。表格之后有更多描述。Options that can be used with ndb_waiter are shown in the following table. Additional descriptions follow the table.

用法Usage

ndb_waiter [-c connection_string]

其他选项Additional Options

  • --character-sets-dir

    命令行格式Command-Line Format --character-sets-dir=path--character-sets-dir=path

    包含字符集的目录。Directory containing character sets.

  • --connect-retries

    命令行格式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.

  • --connect-retry-delay

    命令行格式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.

  • --connect-string

    命令行格式Command-Line Format --connect-string=connection_string
    类型Type 字符串String
    默认值Default Value [none][none]

    与 --ndb-connectstring 相同。Same as --ndb-connectstring.

  • --core-file

    命令行格式Command-Line Format --core-file

    错误时生成核心文件;用于调试。Write core file on error; used in debugging.

  • --defaults-extra-file

    命令行格式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.

  • --defaults-file

    命令行格式Command-Line Format --defaults-file=path
    类型Type 字符串String
    默认值Default Value [none][none]

    仅从指定文件读取默认选项。Read default options from given file only.

  • --defaults-group-suffix

    命令行格式Command-Line Format --defaults-group-suffix=string
    类型Type 字符串String
    默认值Default Value [none][none]

    也读取组合了 concat(group, suffix) 的组。Also read groups with concat(group, suffix).

  • --login-path

    命令行格式Command-Line Format --login-path=path
    类型Type 字符串String
    默认值Default Value [none][none]

    从登录文件读取给定路径。Read given path from login file.

  • --no-login-paths

    命令行格式Command-Line Format --no-login-paths

    跳过从登录路径文件读取选项。Skips reading options from the login path file.

  • --help

    命令行格式Command-Line Format --help--help

    显示帮助文本并退出。Display help text and exit.

  • --ndb-connectstring

    命令行格式Command-Line Format --ndb-connectstring=connection_string
    类型Type 字符串String
    默认值Default Value [none][none]

    设置用于连接到 ndb_mgmd 的连接字符串。语法:[nodeid=id;][host=]hostname[:port]。覆盖 NDB_CONNECTSTRING 和 my.cnf 中的条目。Set connection string for connecting to ndb_mgmd. Syntax: [nodeid=id;][host=]hostname[:port]. Overrides entries in NDB_CONNECTSTRING and my.cnf.

  • --ndb-mgm-tls

    命令行格式Command-Line Format --ndb-mgm-tls=level
    类型Type 枚举Enumeration
    默认值Default Value relaxedrelaxed
    有效值Valid Values

    relaxedrelaxed

    strictstrict

    设置连接到管理服务器所需的 TLS 支持级别;可以是 relaxed 或 strict。relaxed(默认)表示尝试建立 TLS 连接,但不要求成功;strict表示连接必须使用 TLS。Sets the level of TLS support required to connect to the management server; one of relaxed or strict. relaxed (the default) means that a TLS connection is attempted, but success is not required; strict means that TLS is required to connect.

  • --ndb-mgmd-host

    命令行格式Command-Line Format --ndb-mgmd-host=connection_string
    类型Type 字符串String
    默认值Default Value [none][none]

    与 --ndb-connectstring 相同。Same as --ndb-connectstring.

  • --ndb-nodeid

    命令行格式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-selection to disable.

  • --ndb-tls-search-path

    命令行格式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.

  • --no-contact, -n

    与等待STARTED状态不同,ndb_waiter会继续运行,直到集群达到NO_CONTACT状态才退出。Instead of waiting for the STARTED state, ndb_waiter continues running until the cluster reaches NO_CONTACT status before exiting.

  • --no-defaults

    命令行格式Command-Line Format --no-defaults--no-defaults

    除了登录文件之外,不从任何配置文件读取默认选项。Do not read default options from any option file other than login file.

  • --not-started

    与其等待 STARTED 状态,ndb_waiter 会继续运行,直到集群达到 NOT_STARTED 状态才退出。Instead of waiting for the STARTED state, ndb_waiter continues running until the cluster reaches NOT_STARTED status before exiting.

  • --nowait-nodes=list

    使用此选项时,ndb_waiter 不会等待列出的节点 ID。列表以逗号分隔;范围可以用短横表示,如下所示:When this option is used, ndb_waiter does not wait for the nodes whose IDs are listed. The list is comma-delimited; ranges can be indicated by dashes, as shown here:

    $> ndb_waiter --nowait-nodes=1,3,7-9
    
    Important

    不要将此选项与 --wait-nodes 选项一起使用。Do not use this option together with the --wait-nodes option.

  • --print-defaults

    命令行格式Command-Line Format --print-defaults

    打印程序参数列表然后退出。Print program argument list and exit.

  • --timeout=seconds, -t seconds --timeout=seconds, -t seconds

    等待时间。如果在此秒数内未达到所需状态,程序将退出。默认值为 120 秒(1200 个报告周期)。Time to wait. The program exits if the desired state is not achieved within this number of seconds. The default is 120 seconds (1200 reporting cycles).

  • --single-user

    程序等待集群进入单用户模式。The program waits for the cluster to enter single user mode.

  • --usage

    命令行格式Command-Line Format --usage

    显示帮助文本并退出;功能与 --help 相同。Display help text and exit; same as --help.

  • --verbose

    命令行格式Command-Line Format --verbose=#
    类型Type 整数Integer
    默认值Default Value 2
    最小值Minimum Value 0
    最大值Maximum Value 2

    控制打印输出的详细程度。可能的级别及其效果如下所示:Controls verbosity level of printout. Possible levels and their effects are listed here:

    • 0:不打印(仅返回退出代码;退出代码如下所示)。0: Do not print (return exit code only; see following for exit codes).

    • 1:仅打印最终连接状态。1: Print final connection status only.

    • 2:每次检查时打印状态。2: Print status each time it is checked.

      这与 NDB Cluster 8.4 之前版本的行为相同。This is the same behavior as in versions of NDB Cluster previous to 8.4.

    ndb_waiter 返回的退出代码如下,并附有其含义:Exit codes returned by ndb_waiter are listed here, with their meanings:

    • 0:成功。0: Success.

    • 1:等待超时。1: Wait timed out.

    • 2:参数错误,例如无效的节点 ID。2: Parameter error, such as an invalid node ID.

    • 3:连接管理服务器失败。3: Failed to connect to the management server.

  • --version

    命令行格式Command-Line Format --version

    显示版本信息并退出。Display version information and exit.

  • --wait-nodes=list, -w list

    使用此选项时,ndb_waiter只会等待列出 ID 的节点。列表以逗号分隔;可以用连字符表示范围,如下所示:When this option is used, ndb_waiter waits only for the nodes whose IDs are listed. The list is comma-delimited; ranges can be indicated by dashes, as shown here:

    $> ndb_waiter --wait-nodes=2,4-6,10
    
    Important

    不要将此选项与--nowait-nodes选项一起使用。Do not use this option together with the --nowait-nodes option.

示例输出。 这里显示的是在一个 4 节点集群上运行 ndb_waiter 时的输出,该集群中有两个节点已手动关闭然后重新启动。重复的报告(由 ... 表示)已省略。Sample Output.  Shown here is the output from ndb_waiter when run against a 4-node cluster in which two nodes have been shut down and then started again manually. Duplicate reports (indicated by ...) are omitted.

$> ./ndb_waiter -c localhost

Connecting to mgmsrv at (localhost)
State node 1 STARTED
State node 2 NO_CONTACT
State node 3 STARTED
State node 4 NO_CONTACT
Waiting for cluster enter state STARTED

...

State node 1 STARTED
State node 2 UNKNOWN
State node 3 STARTED
State node 4 NO_CONTACT
Waiting for cluster enter state STARTED

...

State node 1 STARTED
State node 2 STARTING
State node 3 STARTED
State node 4 NO_CONTACT
Waiting for cluster enter state STARTED

...

State node 1 STARTED
State node 2 STARTING
State node 3 STARTED
State node 4 UNKNOWN
Waiting for cluster enter state STARTED

...

State node 1 STARTED
State node 2 STARTING
State node 3 STARTED
State node 4 STARTING
Waiting for cluster enter state STARTED

...

State node 1 STARTED
State node 2 STARTED
State node 3 STARTED
State node 4 STARTING
Waiting for cluster enter state STARTED

...

State node 1 STARTED
State node 2 STARTED
State node 3 STARTED
State node 4 STARTED
Waiting for cluster enter state STARTED
Note

如果未指定连接字符串,则 ndb_waiter 会尝试连接 localhost 上的管理节点,并报告 Connecting to mgmsrv at (null)。If no connection string is specified, then ndb_waiter tries to connect to a management on localhost, and reports Connecting to mgmsrv at (null).