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

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

MySQL 8.4 参考手册 / 25 MySQL NDB 集群 8.4 / 25.5 NDB 集群程序 / 25.5.6 ndb_blob_tool — 检查并修复 NDB Cluster 表的 BLOB 和 TEXT 列
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 73%

25.5.6 ndb_blob_tool — 检查并修复 NDB 集群表的 BLOB 和 TEXT 列25.5.6 ndb_blob_tool — Check and Repair BLOB and TEXT columns of NDB Cluster Tables

该工具可用于检查并删除NDB表中的孤立 BLOB 列部分,同时也可生成列出任何孤立部分的文件。在诊断和修复包含BLOB或TEXT列的损坏或受损的NDB表时,有时非常有用。This tool can be used to check for and remove orphaned BLOB column parts from NDB tables, as well as to generate a file listing any orphaned parts. It is sometimes useful in diagnosing and repairing corrupted or damaged NDB tables containing BLOB or TEXT columns.

ndb_blob_tool 的基本语法如下:The basic syntax for ndb_blob_tool is shown here:

ndb_blob_tool [options] table [column, ...]

除非您使用 --help 选项,否则您必须通过包含一个或多个选项 --check-orphans、--delete-orphans 或 --dump-file 来指定要执行的操作。这些选项分别使 ndb_blob_tool 检查孤立的 BLOB 部分、删除任何孤立的 BLOB 部分,以及生成列出孤立 BLOB 部分的转储文件,这些选项将在本节后面更详细地描述。Unless you use the --help option, you must specify an action to be performed by including one or more of the options --check-orphans, --delete-orphans, or --dump-file. These options cause ndb_blob_tool to check for orphaned BLOB parts, remove any orphaned BLOB parts, and generate a dump file listing orphaned BLOB parts, respectively, and are described in more detail later in this section.

在调用 ndb_blob_tool 时,您还必须指定表的名称。此外,您可以在表名后可选地跟上一个或多个 BLOB 或 TEXT 列的名称(以逗号分隔)。如果未列出任何列,工具将对表的所有 BLOB 和 TEXT 列进行操作。如果需要指定数据库,请使用 --database (-d) 选项。You must also specify the name of a table when invoking ndb_blob_tool. In addition, you can optionally follow the table name with the (comma-separated) names of one or more BLOB or TEXT columns from that table. If no columns are listed, the tool works on all of the table's BLOB and TEXT columns. If you need to specify a database, use the --database (-d) option.

--verbose 选项在输出中提供有关工具进度的附加信息。The --verbose option provides additional information in the output about the tool's progress.

所有可以与 ndb_mgmd 一起使用的选项显示在下表中。表格之后有附加说明。All options that can be used with ndb_mgmd are shown in the following table. Additional descriptions follow the table.

  • --add-missing

    命令行格式Command-Line Format --add-missing

    对于 NDB Cluster 表中每个没有对应 BLOB 部分的内联部分,写入一个所需长度的虚拟 BLOB 部分,由空格组成。For each inline part in NDB Cluster tables which has no corresponding BLOB part, write a dummy BLOB part of the required length, consisting of spaces.

  • --character-sets-dir

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

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

  • --check-missing

    命令行格式Command-Line Format --check-missing

    检查 NDB Cluster 表中没有对应 BLOB 部分的内联部分。Check for inline parts in NDB Cluster tables which have no corresponding BLOB parts.

  • --check-orphans

    命令行格式Command-Line Format --check-orphans

    检查 NDB Cluster 表中没有对应内联部分的 BLOB 部分。Check for BLOB parts in NDB Cluster tables which have no corresponding inline parts.

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

  • --database=db_name, -d

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

    指定要在其中查找表的数据库。Specify the database to find the table in.

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

  • --delete-orphans

    命令行格式Command-Line Format --delete-orphans

    从 NDB 集群表中删除没有对应内联部分的 BLOB 部分。Remove BLOB parts from NDB Cluster tables which have no corresponding inline parts.

  • --dump-file=file

    命令行格式Command-Line Format --dump-file=file--dump-file=file
    类型Type 文件名File name
    默认值Default Value [none][none]

    将孤立 BLOB 列的部分列表写入 file。写入文件的信息包括每个孤立 BLOB 部分的表键和 BLOB 部分号。Writes a list of orphaned BLOB column parts to file. The information written to the file includes the table key and BLOB part number for each orphaned BLOB part.

  • --help

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

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

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

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

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

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

  • --print-defaults

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

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

  • --usage

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

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

  • --verbose

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

    在工具的输出中提供有关其进度的额外信息。Provide extra information in the tool's output regarding its progress.

  • --version

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

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

示例Example

首先,我们在 test 数据库中创建一个 NDB 表,使用此处显示的 CREATE TABLE 语句:First we create an NDB table in the test database, using the CREATE TABLE statement shown here:

USE test;

CREATE TABLE btest (
    c0 BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
    c1 TEXT,
    c2 BLOB
)   ENGINE=NDB;

然后我们向这个表中插入几行数据,使用类似于以下的语句:Then we insert a few rows into this table, using a series of statements similar to this one:

INSERT INTO btest VALUES (NULL, 'x', REPEAT('x', 1000));

当对这个表使用 --check-orphans 运行时,ndb_blob_tool 会生成以下输出:When run with --check-orphans against this table, ndb_blob_tool generates the following output:

$> ndb_blob_tool --check-orphans --verbose -d test btest
connected
processing 2 blobs
processing blob #0 c1 NDB$BLOB_19_1
NDB$BLOB_19_1: nextResult: res=1
total parts: 0
orphan parts: 0
processing blob #1 c2 NDB$BLOB_19_2
NDB$BLOB_19_2: nextResult: res=0
NDB$BLOB_19_2: nextResult: res=0
NDB$BLOB_19_2: nextResult: res=0
NDB$BLOB_19_2: nextResult: res=0
NDB$BLOB_19_2: nextResult: res=0
NDB$BLOB_19_2: nextResult: res=0
NDB$BLOB_19_2: nextResult: res=0
NDB$BLOB_19_2: nextResult: res=0
NDB$BLOB_19_2: nextResult: res=0
NDB$BLOB_19_2: nextResult: res=0
NDB$BLOB_19_2: nextResult: res=1
total parts: 10
orphan parts: 0
disconnected

该工具报告指出,与列 c1 相关的 NDB BLOB 列部分不存在,即使 c1 是一个 TEXT 列。这是因为在 NDB 表中,BLOB 或 TEXT 列值的前 256 个字节仅以内联方式存储,只有超过部分(如果有)会单独存储;因此,如果某列中没有值超过 256 字节,则 NDB 不会为该列创建 BLOB 列部分。更多信息请参见 第 13.7 节,“数据类型存储要求”。The tool reports that there are no NDB BLOB column parts associated with column c1, even though c1 is a TEXT column. This is due to the fact that, in an NDB table, only the first 256 bytes of a BLOB or TEXT column value are stored inline, and only the excess, if any, is stored separately; thus, if there are no values using more than 256 bytes in a given column of one of these types, no BLOB column parts are created by NDB for this column. See Section 13.7, “Data Type Storage Requirements”, for more information.