ndb_mgm 管理客户端进程实际上并非运行集群所必需。它的价值在于提供一套命令,用于检查集群状态、启动备份以及执行其他管理功能。管理客户端通过 C API 访问管理服务器。高级用户也可以使用此 API 编写专用管理进程,执行与 ndb_mgm 类似的任务。The ndb_mgm management client process is actually not needed to run the cluster. Its value lies in providing a set of commands for checking the cluster's status, starting backups, and performing other administrative functions. The management client accesses the management server using a C API. Advanced users can also employ this API for programming dedicated management processes to perform tasks similar to those performed by ndb_mgm.
要启动管理客户端,需要提供管理服务器的主机名和端口号:To start the management client, it is necessary to supply the host name and port number of the management server:
$> ndb_mgm [host_name [port_num]]
例如:For example:
$> ndb_mgm ndb_mgmd.mysql.com 1186
默认的主机名和端口号分别是 localhost 和 1186。The default host name and port number are
localhost and 1186, respectively.
以下表格显示了所有可以与 ndb_mgm 一起使用的选项。表格之后有额外的说明。All options that can be used with ndb_mgm are shown in the following table. Additional descriptions follow the table.
--backup-password-from-stdin[=TRUE|FALSE]命令行格式Command-Line Format --backup-password-from-stdin此选项启用在使用
--execute "START BACKUP"或类似命令创建备份时,从系统 shell (stdin) 输入备份密码。使用此选项需要同时使用--execute。This option enables input of the backup password from the system shell (stdin) when using--execute "START BACKUP"or similar to create a backup. Use of this option requires use of--executeas well.命令行格式Command-Line Format --character-sets-dir=path--character-sets-dir=path包含字符集的目录。Directory containing character sets.
命令行格式Command-Line Format --connect-retries=#类型Type 数字Numeric 默认值Default Value 3最小值Minimum Value 0最大值Maximum Value 4294967295此选项指定在第一次尝试后重试连接的次数,直到放弃(客户端总是至少尝试一次连接)。每次尝试的等待时间使用
--connect-retry-delay设置。This option specifies the number of times following the first attempt to retry a connection before giving up (the client always tries the connection at least once). The length of time to wait per attempt is set using--connect-retry-delay.此选项与
--try-reconnect选项同义,后者现已弃用。This option is synonymous with the--try-reconnectoption, which is now deprecated.命令行格式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 --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 --encrypt-backup使用此选项时,所有备份都将被加密。要在每次运行 ndb_mgm 时都实现此功能,请将该选项放入
my.cnf文件的[ndb_mgm]部分。When used, this option causes all backups to be encrypted. To make this happen whenever ndb_mgm is run, put the option in the[ndb_mgm]section of themy.cnffile.--execute=command,-e command--execute=,command-ecommand命令行格式Command-Line Format --execute=command--execute=command此选项可用于从系统 shell 向 NDB Cluster 管理客户端发送命令。例如,以下任意一种方式都等同于在管理客户端中执行
SHOW:This option can be used to send a command to the NDB Cluster management client from the system shell. For example, either of the following is equivalent to executingSHOWin the management client:$>
ndb_mgm -e "SHOW"$>ndb_mgm --execute="SHOW"这类似于
--execute或-e选项在 mysql 命令行客户端中的作用。参见 第 6.2.2.1 节,“在命令行中使用选项”。This is analogous to how the--executeor-eoption works with the mysql command-line client. See Section 6.2.2.1, “Using Options on the Command Line”.Note如果通过此选项传递的管理客户端命令包含任何空格字符,则命令 必须 使用引号括起来。可以使用单引号或双引号。如果管理客户端命令不包含空格字符,则引号是可选的。If the management client command to be passed using this option contains any space characters, then the command must be enclosed in quotation marks. Either single or double quotation marks may be used. If the management client command contains no space characters, the quotation marks are optional.
命令行格式Command-Line Format --help--help显示帮助文本并退出。Display help text and exit.
命令行格式Command-Line Format --login-path=path类型Type 字符串String 默认值Default Value [none][none]从登录文件读取给定路径。Read given path from login file.
命令行格式Command-Line Format --no-login-paths跳过从登录路径文件读取选项。Skips reading options from the login path file.
命令行格式Command-Line Format --ndb-connectstring=connection_string类型Type 字符串String 默认值Default Value [none][none]设置用于连接到 ndb_mgmd 的连接字符串。语法:[
nodeid=][id;host=][hostname:]。覆盖portNDB_CONNECTSTRING和my.cnf中的条目。Set connect string for connecting to ndb_mgmd. Syntax: [nodeid=][id;host=][hostname:]. Overrides entries inportNDB_CONNECTSTRINGandmy.cnf.命令行格式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.命令行格式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.--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 --print-defaults打印程序参数列表然后退出。Print program argument list and exit.
命令行格式Command-Line Format --test-tls使用 TLS 连接,然后退出。如果成功,输出类似如下所示:Connect using TLS, then exit. Output if successful is similar to what is shown here:
>$
ndb_mgm --test-tlsConnected to Management Server at: sakila:1186 >$有关更多信息,请参见 第 25.6.19.5 节,“NDB 集群的 TLS 链接加密”。See Section 25.6.19.5, “TLS Link Encryption for NDB Cluster”, for more information.
命令行格式Command-Line Format --try-reconnect=#已弃用Deprecated 是Yes 类型Type 数字Numeric 类型Type 整数Integer 默认值Default Value 12默认值Default Value 3最小值Minimum Value 0最大值Maximum Value 4294967295如果与管理服务器的连接中断,节点会每隔 5 秒尝试重新连接,直到成功。通过使用此选项,可以在放弃并报告错误之前,将尝试次数限制为
number。If the connection to the management server is broken, the node tries to reconnect to it every 5 seconds until it succeeds. By using this option, it is possible to limit the number of attempts tonumberbefore giving up and reporting an error instead.此选项已弃用,并可能在将来的版本中移除。请使用
--connect-retries。This option is deprecated and subject to removal in a future release. Use--connect-retries, instead.命令行格式Command-Line Format --usage显示帮助文本并退出;与
--help相同。Display help text and exit; same as--help.命令行格式Command-Line Format --version显示版本信息并退出。Display version information and exit.
有关使用 ndb_mgm 的更多信息,请参阅 第 25.6.1 节,“NDB 集群管理客户端中的命令”。Additional information about using ndb_mgm can be found in Section 25.6.1, “Commands in the NDB Cluster Management Client”.