NDB 集群恢复程序是作为一个独立的命令行工具实现的 ndb_restore,通常可以在 MySQL bin 目录中找到。该程序读取备份产生的文件,并将存储的信息插入到数据库中。The NDB Cluster restoration program is implemented as a separate
command-line utility ndb_restore, which can
normally be found in the MySQL bin
directory. This program reads the files created as a result of
the backup and inserts the stored information into the database.
ndb_restore 必须针对每个由 START BACKUP 命令创建的备份文件执行一次(参见 第 25.6.8.2 节,“使用 NDB 集群管理客户端创建备份”)。这等于创建备份时集群中的数据节点数量。ndb_restore must be executed once for each of
the backup files that were created by the
START BACKUP command used to
create the backup (see
Section 25.6.8.2, “Using The NDB Cluster Management Client to Create a Backup”).
This is equal to the number of data nodes in the cluster at the
time that the backup was created.
在使用 ndb_restore 之前,建议集群以单用户模式运行,除非您要并行恢复多个数据节点。更多信息请参见 第 25.6.6 节,“NDB 集群单用户模式”。Before using ndb_restore, it is recommended that the cluster be running in single user mode, unless you are restoring multiple data nodes in parallel. See Section 25.6.6, “NDB Cluster Single User Mode”, for more information.
可以与 ndb_restore 一起使用的选项如下面的表格所示。表格后面有附加说明。Options that can be used with ndb_restore are shown in the following table. Additional descriptions follow the table.
命令行格式Command-Line Format --allow-pk-changes[=0|1]类型Type 整数Integer 默认值Default Value 0最小值Minimum Value 0最大值Maximum Value 1当此选项设置为
1时,ndb_restore 允许表定义中的主键与备份中相同表的主键不同。当在一个或多个表上主键发生更改时,在不同模式版本之间进行备份和恢复时,这可能是可取的,并且使用 ndb_restore 执行恢复操作通常比在恢复表模式和数据后执行多个ALTER TABLE语句更简单或更高效。When this option is set to1, ndb_restore allows the primary keys in a table definition to differ from that of the same table in the backup. This may be desirable when backing up and restoring between different schema versions with primary key changes on one or more tables, and it appears that performing the restore operation using ndb_restore is simpler or more efficient than issuing manyALTER TABLEstatements after restoring table schemas and data.--allow-pk-changes支持如下主键定义的更改:The following changes in primary key definitions are supported by--allow-pk-changes:扩展主键:在备份中的表模式里存在的非空列会成为数据库中该表的主键的一部分。Extending the primary key: A non-nullable column that exists in the table schema in the backup becomes part of the table's primary key in the database.
Important在扩展表的主键时,任何成为主键一部分的列在备份进行时都不能被更新;任何被 ndb_restore 检测到的此类更新都会导致恢复操作失败,即使值没有发生更改。在某些情况下,可能可以使用
--ignore-extended-pk-updates选项覆盖此行为;有关更多信息,请参阅该选项的说明。When extending a table's primary key, any columns which become part of primary key must not be updated while the backup is being taken; any such updates discovered by ndb_restore cause the restore operation to fail, even when no change in value takes place. In some cases, it may be possible to override this behavior using the--ignore-extended-pk-updatesoption; see the description of this option for more information.收缩主键 (1):在备份模式中已经是表主键的一列不再是主键的一部分,但仍保留在表中。Contracting the primary key (1): A column that is already part of the table's primary key in the backup schema is no longer part of the primary key, but remains in the table.
收缩主键 (2):在备份模式中已经是表主键的一列从表中完全移除。Contracting the primary key (2): A column that is already part of the table's primary key in the backup schema is removed from the table entirely.
这些差异可以与ndb_restore支持的其他模式差异结合使用,包括需要使用临时表的 blob 和 text 列的更改。These differences can be combined with other schema differences supported by ndb_restore, including changes to blob and text columns requiring the use of staging tables.
使用主键模式更改的典型场景中的基本步骤如下:Basic steps in a typical scenario using primary key schema changes are listed here:
使用 ndb_restore
--restore-meta恢复表模式Restore table schemas using ndb_restore--restore-meta将模式更改为所需的,或创建它Alter schema to that desired, or create it
备份所需的模式Back up the desired schema
使用上一步的备份运行 ndb_restore
--disable-indexes,以删除索引和约束Run ndb_restore--disable-indexesusing the backup from the previous step, to drop indexes and constraints运行 ndb_restore
--allow-pk-changes(可能还需使用--ignore-extended-pk-updates、--disable-indexes,以及根据需要的其他选项)来恢复所有数据Run ndb_restore--allow-pk-changes(possibly along with--ignore-extended-pk-updates,--disable-indexes, and possibly other options as needed) to restore all data使用所需模式制作的备份运行 ndb_restore
--rebuild-indexes,以重建索引和约束条件Run ndb_restore--rebuild-indexesusing the backup made with the desired schema, to rebuild indexes and constraints
在扩展主键时,ndb_restore 可能需要在恢复操作中使用临时的二级唯一索引,以将旧主键映射到新主键。仅在将备份日志中的事件应用于具有扩展主键的表时才创建这样的索引。该索引名为
NDB$RESTORE_PK_MAPPING,并在每个需要的表上创建;如果有必要,它可以被多个并行运行的 ndb_restore 实例共享。(在恢复过程结束时运行 ndb_restore--rebuild-indexes会导致该索引被删除。)When extending the primary key, it may be necessary for ndb_restore to use a temporary secondary unique index during the restore operation to map from the old primary key to the new one. Such an index is created only when necessary to apply events from the backup log to a table which has an extended primary key. This index is namedNDB$RESTORE_PK_MAPPING, and is created on each table requiring it; it can be shared, if necessary, by multiple instances of ndb_restore instances running in parallel. (Running ndb_restore--rebuild-indexesat the end of the restore process causes this index to be dropped.)命令行格式Command-Line Format --append当与
--tab和--print-data选项一起使用时,这会将数据追加到任何具有相同名称的现有文件中。When used with the--taband--print-dataoptions, this causes the data to be appended to any existing files having the same names.--backup-path=dir_name命令行格式Command-Line Format --backup-path=path--backup-path=path类型Type 目录名称Directory name 默认值Default Value ./需要提供备份目录的路径;这是通过 ndb_restore 使用
--backup-path选项提供的,并且必须包含对应于要恢复的备份 ID 的子目录。例如,如果数据节点的DataDir是/var/lib/mysql-cluster,那么备份目录就是/var/lib/mysql-cluster/BACKUP,ID 为 3 的备份文件可以在/var/lib/mysql-cluster/BACKUP/BACKUP-3中找到。该路径可以是绝对路径,也可以是相对于 ndb_restore 可执行文件所在目录的相对路径,并且可以选择性地加上backup-path=前缀。The path to the backup directory is required; this is supplied to ndb_restore using the--backup-pathoption, and must include the subdirectory corresponding to the ID backup of the backup to be restored. For example, if the data node'sDataDiris/var/lib/mysql-cluster, then the backup directory is/var/lib/mysql-cluster/BACKUP, and the backup files for the backup with the ID 3 can be found in/var/lib/mysql-cluster/BACKUP/BACKUP-3. The path may be absolute or relative to the directory in which the ndb_restore executable is located, and may be optionally prefixed withbackup-path=.可以将备份恢复到与其创建时配置不同的数据库。例如,假设一个备份 ID 为
12的备份,是在具有两个存储节点(节点 ID 分别为2和3)的集群中创建的,现在要将其恢复到一个有四个节点的集群中。那么必须运行 ndb_restore 两次——每次对应备份时所在集群的一个存储节点。然而,ndb_restore 并不总是能将一个 MySQL 版本的集群创建的备份恢复到运行不同 MySQL 版本的集群。有关更多信息,请参见 第 25.3.7 节“升级和降级 NDB 集群”。It is possible to restore a backup to a database with a different configuration than it was created from. For example, suppose that a backup with backup ID12, created in a cluster with two storage nodes having the node IDs2and3, is to be restored to a cluster with four nodes. Then ndb_restore must be run twice—once for each storage node in the cluster where the backup was taken. However, ndb_restore cannot always restore backups made from a cluster running one version of MySQL to a cluster running a different MySQL version. See Section 25.3.7, “Upgrading and Downgrading NDB Cluster”, for more information.Important无法使用较旧版本的ndb_restore恢复由较新版本的 NDB Cluster 创建的备份。您可以将由较新版本的 MySQL 创建的备份恢复到较旧的集群,但必须使用较新 NDB Cluster 版本的ndb_restore副本来执行此操作。It is not possible to restore a backup made from a newer version of NDB Cluster using an older version of ndb_restore. You can restore a backup made from a newer version of MySQL to an older cluster, but you must use a copy of ndb_restore from the newer NDB Cluster version to do so.
例如,要将从运行 NDB Cluster 8.4.7 的集群获取的集群备份恢复到运行 NDB Cluster 8.0.44 的集群,必须使用随 NDB Cluster 8.0.44 发行版提供的 ndb_restore。For example, to restore a cluster backup taken from a cluster running NDB Cluster 8.4.7 to a cluster running NDB Cluster 8.0.44, you must use the ndb_restore that comes with the NDB Cluster 8.0.44 distribution.
为了更快速的恢复,数据可以并行恢复,前提是有足够数量的集群连接可用。也就是说,当并行恢复到多个节点时,您必须为每个并发的 ndb_restore 进程在集群
config.ini文件中拥有一个[api]或[mysqld]节。然而,数据文件必须始终在日志之前应用。For more rapid restoration, the data may be restored in parallel, provided that there is a sufficient number of cluster connections available. That is, when restoring to multiple nodes in parallel, you must have an[api]or[mysqld]section in the clusterconfig.inifile available for each concurrent ndb_restore process. However, the data files must always be applied before the logs.命令行格式Command-Line Format --backup-password=password类型Type 字符串String 默认值Default Value [none][none]此选项用于指定在使用
--decrypt选项解密加密备份时使用的密码。此密码必须与用于加密备份的密码相同。This option specifies a password to be used when decrypting an encrypted backup with the--decryptoption. This must be the same password that was used to encrypt the backup.密码长度必须为 1 到 256 个字符,并且必须用单引号或双引号括起来。它可以包含 ASCII 码为 32、35、38、40-91、93、95 和 97-126 的任意字符;换句话说,它可以使用任何可打印的 ASCII 字符,但不能使用
!、'、"、$、%、\和^。The password must be 1 to 256 characters in length, and must be enclosed by single or double quotation marks. It can contain any of the ASCII characters having character codes 32, 35, 38, 40-91, 93, 95, and 97-126; in other words, it can use any printable ASCII characters except for!,',",$,%,\, and^.可以省略密码,在这种情况下,ndb_restore 会等待从
stdin提供密码,就像使用--backup-password-from-stdin时一样。It is possible to omit the password, in which case ndb_restore waits for it to be supplied fromstdin, as when using--backup-password-from-stdin.--backup-password-from-stdin[=TRUE|FALSE]命令行格式Command-Line Format --backup-password-from-stdin当用来替代
--backup-password时,此选项允许从系统 shell (stdin) 输入备份密码,类似于在交互式向 mysql 提供密码时的方式,当使用--password且不在命令行上提供密码时。When used in place of--backup-password, this option enables input of the backup password from the system shell (stdin), similar to how this is done when supplying the password interactively to mysql when using the--passwordwithout supplying the password on the command line.--backupid=#,-b命令行格式Command-Line Format --backupid=#类型Type 数字Numeric 默认值Default Value nonenone此选项是必需的;用于指定备份的 ID 或序列号,并且该编号与管理客户端在备份完成时显示的
Backup backup_id completed消息中显示的编号相同。(参见 第 25.6.8.2 节,“使用 NDB 集群管理客户端创建备份”。)This option is required; it is used to specify the ID or sequence number of the backup, and is the same number shown by the management client in theBackupmessage displayed upon completion of a backup. (See Section 25.6.8.2, “Using The NDB Cluster Management Client to Create a Backup”.)backup_idcompletedImportant在恢复集群备份时,必须确保从具有相同备份 ID 的备份中恢复所有数据节点。使用来自不同备份的文件,最多可能会将集群恢复到不一致状态,并且很可能完全失败。When restoring cluster backups, you must be sure to restore all data nodes from backups having the same backup ID. Using files from different backups results at best in restoring the cluster to an inconsistent state, and is likely to fail altogether.
命令行格式Command-Line Format --character-sets-dir=path--character-sets-dir=path包含字符集的目录。Directory containing character sets.
--connect,-c命令行格式Command-Line Format --connect=connection_string类型Type 字符串String 默认值Default Value localhost:1186是
--ndb-connectstring的别名。Alias for--ndb-connectstring.命令行格式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 --core-file错误时生成核心文件;用于调试。Write core file on error; used in debugging.
命令行格式Command-Line Format --decrypt使用通过
--backup-password选项提供的密码解密备份。Decrypt an encrypted backup using the password supplied by the--backup-passwordoption.命令行格式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 --disable-indexes在从原生
NDB备份恢复数据时禁用索引的恢复。之后,您可以使用多线程索引构建通过--rebuild-indexes一次性为所有表恢复索引,这对于非常大的表比同时重建索引更快。Disable restoration of indexes during restoration of the data from a nativeNDBbackup. Afterwards, you can restore indexes for all tables at once with multithreaded building of indexes using--rebuild-indexes, which should be faster than rebuilding indexes concurrently for very large tables.此选项还会删除备份中指定的任何外键。This option also drops any foreign keys specified in the backup.
MySQL 可以打开一个
NDB表,即使找不到一个或多个索引,只要查询不使用任何受影响的索引;否则查询将被拒绝,并显示ER_NOT_KEYFILE。在后一种情况下,你可以通过执行如下ALTER TABLE语句暂时解决问题:MySQL can open anNDBtable for which one or more indexes cannot be found, provided the query does not use any of the affected indexes; otherwise the query is rejected withER_NOT_KEYFILE. In the latter case, you can temporarily work around the problem by executing anALTER TABLEstatement such as this one:ALTER TABLE tbl ALTER INDEX idx INVISIBLE;
这会导致 MySQL 忽略表
tbl上的索引idx。有关更多信息,请参阅 主键和索引,以及 第 10.3.12 节,“不可见索引”。This causes MySQL to ignore the indexidxon tabletbl. See Primary Keys and Indexes, for more information, as well as Section 10.3.12, “Invisible Indexes”.命令行格式Command-Line Format --dont-ignore-systab-0通常,在恢复表数据和元数据时,ndb_restore 会忽略备份中存在的
NDB系统表的副本。--dont-ignore-systab-0会导致系统表被恢复。此选项仅用于实验和开发目的,不建议在生产环境中使用。Normally, when restoring table data and metadata, ndb_restore ignores the copy of theNDBsystem table that is present in the backup.--dont-ignore-systab-0causes the system table to be restored. This option is intended for experimental and development use only, and is not recommended in a production environment.--exclude-databases=db-list命令行格式Command-Line Format --exclude-databases=list类型Type 字符串String 默认值Default Value 以逗号分隔的一个或多个数据库列表,这些数据库不应被恢复。Comma-delimited list of one or more databases which should not be restored.
此选项通常与
--exclude-tables一起使用;有关更多信息和示例,请参阅该选项的描述。This option is often used in combination with--exclude-tables; see that option's description for further information and examples.--exclude-intermediate-sql-tables[=TRUE|FALSE]命令行格式Command-Line Format --exclude-intermediate-sql-tables[=TRUE|FALSE]类型Type 布尔Boolean 默认值Default Value TRUE在执行复制
ALTER TABLE操作时,mysqld 会创建中间表(其名称以#sql-为前缀)。当TRUE时,--exclude-intermediate-sql-tables选项会阻止 ndb_restore 恢复可能由这些操作遗留下来的此类表。此选项默认值为TRUE。When performing copyingALTER TABLEoperations, mysqld creates intermediate tables (whose names are prefixed with#sql-). WhenTRUE, the--exclude-intermediate-sql-tablesoption keeps ndb_restore from restoring such tables that may have been left over from these operations. This option isTRUEby default.命令行格式Command-Line Format --exclude-missing-columns使用此选项可以仅恢复选定的表列,这会导致ndb_restore忽略与备份中表的版本相比,在恢复的表中缺失的任何列。此选项适用于所有正在恢复的表。如果您希望仅对选定的表或数据库应用此选项,可以将其与本节其他地方描述的一个或多个
--include-*或--exclude-*选项组合使用,然后使用这些选项的互补组合将数据恢复到其余表中。It is possible to restore only selected table columns using this option, which causes ndb_restore to ignore any columns missing from tables being restored as compared to the versions of those tables found in the backup. This option applies to all tables being restored. If you wish to apply this option only to selected tables or databases, you can use it in combination with one or more of the--include-*or--exclude-*options described elsewhere in this section to do so, then restore data to the remaining tables using a complementary set of these options.命令行格式Command-Line Format --exclude-missing-tables可以使用此选项仅恢复选定的表,这会导致 ndb_restore 忽略在目标数据库中未找到的备份表。It is possible to restore only selected tables using this option, which causes ndb_restore to ignore any tables from the backup that are not found in the target database.
--exclude-tables=table-list命令行格式Command-Line Format --exclude-tables=list类型Type 字符串String 默认值Default Value 要排除的一个或多个表的列表;每个表引用必须包括数据库名称。通常与
--exclude-databases一起使用。List of one or more tables to exclude; each table reference must include the database name. Often used together with--exclude-databases.当使用
--exclude-databases或--exclude-tables时,只有选项中指定的那些数据库或表会被排除;所有其他数据库和表将由 ndb_restore 恢复。When--exclude-databasesor--exclude-tablesis used, only those databases or tables named by the option are excluded; all other databases and tables are restored by ndb_restore.此表显示了几次使用 ndb_restore 的调用,并使用
--exclude-*选项(为了清晰可能省略了其他必需选项),以及这些选项对从 NDB Cluster 备份恢复的影响:This table shows several invocations of ndb_restore using--exclude-*options (other options possibly required have been omitted for clarity), and the effects these options have on restoring from an NDB Cluster backup:表 25.23 使用 --exclude-* 选项的 ndb_restore 的几次调用,以及这些选项对从 NDB Cluster 备份恢复的影响。Table 25.23 Several invocations of ndb_restore using --exclude-* options, and the effects these options have on restoring from an NDB Cluster backup.
选项Option 结果Result --exclude-databases=db1除 db1外,所有数据库中的所有表都将被恢复;db1中的表不会被恢复All tables in all databases exceptdb1are restored; no tables indb1are restored--exclude-databases=db1,db2(或--exclude-databases=db1--exclude-databases=db2)--exclude-databases=db1,db2(or--exclude-databases=db1--exclude-databases=db2)恢复所有数据库中的所有表,但不包括 db1和db2;db1或db2中的表不会被恢复All tables in all databases exceptdb1anddb2are restored; no tables indb1ordb2are restored--exclude-tables=db1.t1恢复 db1中除t1以外的所有表;db1中的其他表会被恢复;所有其他数据库中的表都会被恢复All tables exceptt1in databasedb1are restored; all other tables indb1are restored; all tables in all other databases are restored--exclude-tables=db1.t2,db2.t1(或--exclude-tables=db1.t2--exclude-tables=db2.t1))--exclude-tables=db1.t2,db2.t1(or--exclude-tables=db1.t2--exclude-tables=db2.t1)数据库 db1中的所有表(除了t2)以及数据库db2中的所有表(除了表t1)被恢复;db1或db2中的其他表不被恢复;所有其他数据库中的所有表都被恢复All tables in databasedb1except fort2and all tables in databasedb2except for tablet1are restored; no other tables indb1ordb2are restored; all tables in all other databases are restored你可以将这两个选项一起使用。例如,下面的操作会导致恢复所有数据库中的表,除了 数据库
db1和db2,以及数据库db3中的表t1和t2:You can use these two options together. For example, the following causes all tables in all databases except for databasesdb1anddb2, and tablest1andt2in databasedb3, to be restored:$>
ndb_restore [...] --exclude-databases=db1,db2 --exclude-tables=db3.t1,db3.t2(同样,为了清晰和简洁,上述示例中省略了其他可能必要的选项。)(Again, we have omitted other possibly necessary options in the interest of clarity and brevity from the example just shown.)
你可以同时使用
--include-*和--exclude-*选项,但需遵循以下规则:You can use--include-*and--exclude-*options together, subject to the following rules:所有
--include-*和--exclude-*选项的操作是累积的。The actions of all--include-*and--exclude-*options are cumulative.所有
--include-*和--exclude-*选项会按照传入 ndb_restore 的顺序从右到左进行评估。All--include-*and--exclude-*options are evaluated in the order passed to ndb_restore, from right to left.如果选项冲突,则优先使用第一个(最右边的)选项。换句话说,从右到左,第一个与给定数据库或表匹配的选项 “胜出”。In the event of conflicting options, the first (rightmost) option takes precedence. In other words, the first option (going from right to left) that matches against a given database or table “wins”.
例如,以下选项集会导致 ndb_restore 从数据库
db1中恢复除db1.t1以外的所有表,同时不恢复任何其他数据库的表:For example, the following set of options causes ndb_restore to restore all tables from databasedb1exceptdb1.t1, while restoring no other tables from any other databases:--include-databases=db1 --exclude-tables=db1.t1
然而,仅仅颠倒刚才给出的选项顺序,会导致恢复来自数据库
db1的所有表(包括db1.t1,但不会有任何其他数据库的表),因为最靠右的--include-databases选项首先匹配数据库db1,因此优先于任何其他匹配db1或db1中的表的选项:However, reversing the order of the options just given simply causes all tables from databasedb1to be restored (includingdb1.t1, but no tables from any other database), because the--include-databasesoption, being farthest to the right, is the first match against databasedb1and thus takes precedence over any other option that matchesdb1or any tables indb1:--exclude-tables=db1.t1 --include-databases=db1
--fields-enclosed-by=char命令行格式Command-Line Format --fields-enclosed-by=char类型Type 字符串String 默认值Default Value 每个列值都被传递给此选项的字符串包围(无论数据类型如何;参见
--fields-optionally-enclosed-by的描述)。Each column value is enclosed by the string passed to this option (regardless of data type; see the description of--fields-optionally-enclosed-by).--fields-optionally-enclosed-by命令行格式Command-Line Format --fields-optionally-enclosed-by类型Type 字符串String 默认值Default Value 传递给此选项的字符串用于包围包含字符数据的列值(例如
CHAR、VARCHAR、BINARY、TEXT或ENUM)。The string passed to this option is used to enclose column values containing character data (such asCHAR,VARCHAR,BINARY,TEXT, orENUM).命令行格式Command-Line Format --fields-terminated-by=char类型Type 字符串String 默认值Default Value \t (tab)\t (tab)传递给此选项的字符串用于分隔列值。默认值是制表符 (
\t)。The string passed to this option is used to separate column values. The default value is a tab character (\t).命令行格式Command-Line Format --help--help显示帮助文本并退出。Display help text and exit.
命令行格式Command-Line Format --hex如果使用此选项,所有二进制值将以十六进制格式输出。If this option is used, all binary values are output in hexadecimal format.
命令行格式Command-Line Format --ignore-extended-pk-updates[=0|1]类型Type 整数Integer 默认值Default Value 0最小值Minimum Value 0最大值Maximum Value 1使用
--allow-pk-changes时,成为表主键部分的列在备份进行时不得更新;这些列应保持从插入数据起到包含这些值的行被删除之间的值不变。如果 ndb_restore 在恢复备份时遇到这些列的更新,恢复将失败。由于某些应用程序在更新行时可能会为所有列设置值,即使某些列值未被更改,备份可能会包含看似更新了实际上未修改的列的日志事件。在这种情况下,您可以将--ignore-extended-pk-updates设置为1,强制 ndb_restore 忽略这些更新。When using--allow-pk-changes, columns which become part of a table's primary key must not be updated while the backup is being taken; such columns should keep the same values from the time values are inserted into them until the rows containing the values are deleted. If ndb_restore encounters updates to these columns when restoring a backup, the restore fails. Because some applications may set values for all columns when updating a row, even when some column values are not changed, the backup may include log events appearing to update columns which are not in fact modified. In such cases you can set--ignore-extended-pk-updatesto1, forcing ndb_restore to ignore such updates.Important在导致这些更新被忽略时,用户有责任确保没有任何列的值更新,而这些列成为主键的一部分。When causing these updates to be ignored, the user is responsible for ensuring that there are no updates to the values of any columns that become part of the primary key.
更多信息,请参阅
--allow-pk-changes的描述。For more information, see the description of--allow-pk-changes.--include-databases=db-list命令行格式Command-Line Format --include-databases=list类型Type 字符串String 默认值Default Value 以逗号分隔的一个或多个要还原的数据库列表。通常与
--include-tables一起使用;有关进一步信息和示例,请参阅该选项的说明。Comma-delimited list of one or more databases to restore. Often used together with--include-tables; see the description of that option for further information and examples.命令行格式Command-Line Format --include-stored-grantsndb_restore 默认不会恢复共享用户和权限(参见 第 25.6.13 节,“权限同步与 NDB_STORED_USER”)到
ndb_sql_metadata表。指定此选项会使其执行恢复。ndb_restore does not by default restore shared users and grants (see Section 25.6.13, “Privilege Synchronization and NDB_STORED_USER”) to thendb_sql_metadatatable. Specifying this option causes it to do so.--include-tables=table-list命令行格式Command-Line Format --include-tables=list类型Type 字符串String 默认值Default Value 要恢复的表的逗号分隔列表;每个表引用必须包含数据库名称。Comma-delimited list of tables to restore; each table reference must include the database name.
当使用
--include-databases或--include-tables时,只有那些由选项指定的数据库或表会被恢复;所有其他数据库和表会被 ndb_restore 排除,并且不会被恢复。When--include-databasesor--include-tablesis used, only those databases or tables named by the option are restored; all other databases and tables are excluded by ndb_restore, and are not restored.下表显示了几种使用 ndb_restore 时使用
--include-*选项的实例(为清楚起见,可能需要的其他选项已略去),以及这些选项对从 NDB Cluster 备份恢复的影响:The following table shows several invocations of ndb_restore using--include-*options (other options possibly required have been omitted for clarity), and the effects these have on restoring from an NDB Cluster backup:表 25.24 使用 --include-* 选项调用 ndb_restore 的几种方式,以及它们在从 NDB 集群备份恢复时的效果。Table 25.24 Several invocations of ndb_restore using --include-* options, and their effects on restoring from an NDB Cluster backup.
选项Option 结果Result --include-databases=db1仅恢复数据库 db1中的表;其他所有数据库中的表都将被忽略Only tables in databasedb1are restored; all tables in all other databases are ignored--include-databases=db1,db2(或--include-databases=db1--include-databases=db2)--include-databases=db1,db2(or--include-databases=db1--include-databases=db2)仅恢复数据库 db1和db2中的表;其他所有数据库中的表都将被忽略Only tables in databasesdb1anddb2are restored; all tables in all other databases are ignored--include-tables=db1.t1仅恢复数据库 db1中的表t1;db1或任何其他数据库中的其他表都不会被恢复Only tablet1in databasedb1is restored; no other tables indb1or in any other database are restored--include-tables=db1.t2,db2.t1(或--include-tables=db1.t2--include-tables=db2.t1)--include-tables=db1.t2,db2.t1(or--include-tables=db1.t2--include-tables=db2.t1)仅恢复数据库 db1中的表t2和数据库db2中的表t1;db1、db2或其他任何数据库中的其他表不会被恢复Only the tablet2in databasedb1and the tablet1in databasedb2are restored; no other tables indb1,db2, or any other database are restored您也可以将这两个选项一起使用。例如,以下操作会恢复数据库
db1和db2中的所有表,以及数据库db3中的表t1和t2(且不恢复其他任何数据库或表):You can also use these two options together. For example, the following causes all tables in databasesdb1anddb2, together with the tablest1andt2in databasedb3, to be restored (and no other databases or tables):$>
ndb_restore [...] --include-databases=db1,db2 --include-tables=db3.t1,db3.t2(同样,我们在上面的示例中省略了其他可能需要的选项。)(Again we have omitted other, possibly required, options in the example just shown.)
还可以仅恢复选定的数据库,或者从单个数据库中恢复选定的表,而无需任何
--include-*(或--exclude-*)选项,使用此处显示的语法:It also possible to restore only selected databases, or selected tables from a single database, without any--include-*(or--exclude-*) options, using the syntax shown here:ndb_restore
other_optionsdb_name,[db_name[,...] |tbl_name[,tbl_name][,...]]换句话说,您可以指定下列任何一种进行恢复:In other words, you can specify either of the following to be restored:
一个或多个数据库中的所有表All tables from one or more databases
单个数据库中的一个或多个表One or more tables from a single database
命令行格式Command-Line Format --lines-terminated-by=char类型Type 字符串String 默认值Default Value \n (linebreak)\n (linebreak)指定用于结束每行输出的字符串。默认是换行符字符 (
\n)。Specifies the string used to end each line of output. The default is a linefeed character (\n).命令行格式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 --lossy-conversions此选项旨在补充
--promote-attributes选项。使用--lossy-conversions允许在从备份恢复数据时对列值进行有损转换(类型降级或符号变化)。在某些例外情况下,降级规则与 MySQL 复制相同;有关属性降级当前支持的特定类型转换的信息,请参见第 19.5.1.9.2 节,“具有不同数据类型的列的复制”。This option is intended to complement the--promote-attributesoption. Using--lossy-conversionsallows lossy conversions of column values (type demotions or changes in sign) when restoring data from backup. With some exceptions, the rules governing demotion are the same as for MySQL replication; see Section 19.5.1.9.2, “Replication of Columns Having Different Data Types”, for information about specific type conversions currently supported by attribute demotion.此选项还可以将
NULL列恢复为NOT NULL。该列不能包含任何NULL条目;否则 ndb_restore 会报错并停止。This option also makes it possible to restore aNULLcolumn asNOT NULL. The column must not contain anyNULLentries; otherwise ndb_restore stops with an error.ndb_restore 会在对每个属性和列进行有损转换时,报告其执行的任何数据截断。ndb_restore reports any truncation of data that it performs during lossy conversions once per attribute and column.
命令行格式Command-Line Format --no-binlog此选项可防止任何已连接的 SQL 节点将由 ndb_restore 恢复的数据写入它们的二进制日志。This option prevents any connected SQL nodes from writing data restored by ndb_restore to their binary logs.
命令行格式Command-Line Format --no-restore-disk-objects此选项阻止 ndb_restore 恢复任何 NDB 集群磁盘数据对象,例如表空间和日志文件组;有关这些内容的更多信息,请参见 第 25.6.11 节,“NDB 集群磁盘表”。This option stops ndb_restore from restoring any NDB Cluster Disk Data objects, such as tablespaces and log file groups; see Section 25.6.11, “NDB Cluster Disk Data Tables”, for more information about these.
--no-upgrade,-u命令行格式Command-Line Format --no-upgrade在使用 ndb_restore 恢复备份时,使用旧固定格式创建的
VARCHAR列会被调整大小并使用现在采用的可变宽格式重新创建。通过指定--no-upgrade可以覆盖此行为。When using ndb_restore to restore a backup,VARCHARcolumns created using the old fixed format are resized and recreated using the variable-width format now employed. This behavior can be overridden by specifying--no-upgrade.命令行格式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=. Overrides entries inid;][host=]hostname[:port]NDB_CONNECTSTRINGandmy.cnf.命令行格式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-nodegroup-map=map,-z命令行格式Command-Line Format --ndb-nodegroup-map=map为此选项设置的任何值将被忽略,并且该选项本身不执行任何操作。Any value set for this option is ignored, and the option itself does nothing.
命令行格式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.
--nodeid=#,-n命令行格式Command-Line Format --nodeid=#类型Type 数字Numeric 默认值Default Value nonenone指定备份时所在的数据节点的节点 ID;必填。Specify the node ID of the data node on which the backup was taken; required.
当恢复到的数据节点数量与备份时的数量不同的集群时,此信息有助于确定需要恢复到指定节点的正确文件集。(在这种情况下,通常需要将多个文件恢复到单个数据节点。)有关更多信息和示例,请参见 恢复到不同数量的数据节点。When restoring to a cluster with different number of data nodes from that where the backup was taken, this information helps identify the correct set or sets of files to be restored to a given node. (In such cases, multiple files usually need to be restored to a single data node.) See Restoring to a different number of data nodes, for additional information and examples.
命令行格式Command-Line Format --num-slices=#类型Type 整数Integer 默认值Default Value 1最小值Minimum Value 1最大值Maximum Value 1024在通过切片恢复备份时,此选项设置将备份划分为多少个切片。这样可以让多个 ndb_restore 实例并行恢复不重叠的子集,可能减少执行恢复操作所需的时间。When restoring a backup by slices, this option sets the number of slices into which to divide the backup. This allows multiple instances of ndb_restore to restore disjoint subsets in parallel, potentially reducing the amount of time required to perform the restore operation.
一个 片 是给定备份中数据的一个子集;也就是说,它是一组具有相同片 ID 的片段,可以使用
--slice-id选项来指定。这两个选项必须始终一起使用,并且--slice-id设置的值必须始终小于片的数量。A slice is a subset of the data in a given backup; that is, it is a set of fragments having the same slice ID, specified using the--slice-idoption. The two options must always be used together, and the value set by--slice-idmust always be less than the number of slices.ndb_restore 遇到碎片时,会为每个碎片分配一个碎片计数器。按切片恢复时,会为每个碎片分配一个切片 ID;该切片 ID 的范围从 0 到切片数减 1。对于非
BLOB表的表,某个碎片所属的切片是使用此处显示的公式确定的:ndb_restore encounters fragments and assigns each one a fragment counter. When restoring by slices, a slice ID is assigned to each fragment; this slice ID is in the range 0 to 1 less than the number of slices. For a table that is not aBLOBtable, the slice to which a given fragment belongs is determined using the formula shown here:[
slice_ID] = [fragment_counter] % [number_of_slices]对于一个
BLOB表,不使用片段计数器;而是使用片段号,以及BLOB表的主表 ID(回想一下,NDB内部将BLOB值存储在单独的表中)。在这种情况下,给定片段的切片 ID 计算方法如下所示:For aBLOBtable, a fragment counter is not used; the fragment number is used instead, along with the ID of the main table for theBLOBtable (recall thatNDBstoresBLOBvalues in a separate table internally). In this case, the slice ID for a given fragment is calculated as shown here:[
slice_ID] = ([main_table_ID] + [fragment_ID]) % [number_of_slices]因此,通过
N个切片进行恢复意味着运行N个 ndb_restore 实例,所有实例都使用--num-slices=(以及任何其他必要的选项),并且每个实例分别使用N--slice-id=1、--slice-id=2、--slice-id=3,依此类推,直到slice-id=。Thus, restoring byN-1Nslices means runningNinstances of ndb_restore, all with--num-slices=(along with any other necessary options) and one each withN--slice-id=1,--slice-id=2,--slice-id=3, and so on throughslice-id=.N-1示例。 假设您想要恢复一个名为
BACKUP-1的备份,该备份位于每个数据节点文件系统的默认目录/var/lib/mysql-cluster/BACKUP/BACKUP-3中,将其恢复到一个拥有节点 ID 为 1、2、3 和 4 的四数据节点集群。要使用五个切片执行此操作,请执行下列命令集:Example. Assume that you want to restore a backup namedBACKUP-1, found in the default directory/var/lib/mysql-cluster/BACKUP/BACKUP-3on the node file system on each data node, to a cluster with four data nodes having the node IDs 1, 2, 3, and 4. To perform this operation using five slices, execute the sets of commands shown in the following list:使用 ndb_restore 恢复集群元数据,如下所示:Restore the cluster metadata using ndb_restore as shown here:
$>
ndb_restore -b 1 -n 1 -m --disable-indexes --backup-path=/home/ndbuser/backups调用 ndb_restore 将集群数据恢复到数据节点,如下所示:Restore the cluster data to the data nodes invoking ndb_restore as shown here:
$>
ndb_restore -b 1 -n 1 -r --num-slices=5 --slice-id=0 --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1$>ndb_restore -b 1 -n 1 -r --num-slices=5 --slice-id=1 --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1$>ndb_restore -b 1 -n 1 -r --num-slices=5 --slice-id=2 --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1$>ndb_restore -b 1 -n 1 -r --num-slices=5 --slice-id=3 --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1$>ndb_restore -b 1 -n 1 -r --num-slices=5 --slice-id=4 --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1$>ndb_restore -b 1 -n 2 -r --num-slices=5 --slice-id=0 --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1$>ndb_restore -b 1 -n 2 -r --num-slices=5 --slice-id=1 --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1$>ndb_restore -b 1 -n 2 -r --num-slices=5 --slice-id=2 --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1$>ndb_restore -b 1 -n 2 -r --num-slices=5 --slice-id=3 --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1$>ndb_restore -b 1 -n 2 -r --num-slices=5 --slice-id=4 --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1$>ndb_restore -b 1 -n 3 -r --num-slices=5 --slice-id=0 --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1$>ndb_restore -b 1 -n 3 -r --num-slices=5 --slice-id=1 --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1$>ndb_restore -b 1 -n 3 -r --num-slices=5 --slice-id=2 --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1$>ndb_restore -b 1 -n 3 -r --num-slices=5 --slice-id=3 --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1$>ndb_restore -b 1 -n 3 -r --num-slices=5 --slice-id=4 --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1$>ndb_restore -b 1 -n 4 -r --num-slices=5 --slice-id=0 --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1$>ndb_restore -b 1 -n 4 -r --num-slices=5 --slice-id=1 --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1$>ndb_restore -b 1 -n 4 -r --num-slices=5 --slice-id=2 --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1$>ndb_restore -b 1 -n 4 -r --num-slices=5 --slice-id=3 --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1$>ndb_restore -b 1 -n 4 -r --num-slices=5 --slice-id=4 --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1本步骤中显示的所有命令都可以并行执行,前提是集群有足够的连接槽(请参阅
--backup-path选项的说明)。All of the commands just shown in this step can be executed in parallel, provided there are enough slots for connections to the cluster (see the description for the--backup-pathoption).像往常一样恢复索引,如下所示:Restore indexes as usual, as shown here:
$>
ndb_restore -b 1 -n 1 --rebuild-indexes --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1最后,使用这里显示的命令恢复纪元:Finally, restore the epoch, using the command shown here:
$>
ndb_restore -b 1 -n 1 --restore-epoch --backup-path=/var/lib/mysql-cluster/BACKUP/BACKUP-1
您应该使用切片来仅恢复集群数据;在恢复元数据、索引或时期信息时,不必使用
--num-slices或--slice-id。如果在控制这些内容恢复的 ndb_restore 选项中使用了其中一个或两个选项,程序会忽略它们。You should use slicing to restore the cluster data only; it is not necessary to employ--num-slicesor--slice-idwhen restoring the metadata, indexes, or epoch information. If either or both of these options are used with the ndb_restore options controlling restoration of these, the program ignores them.The effects of using the
--parallelismoption on the speed of restoration are independent of those produced by slicing or parallel restoration using multiple instances of ndb_restore (--parallelismspecifies the number of parallel transactions executed by a single ndb_restore thread), but it can be used together with either or both of these. You should be aware that increasing--parallelismcauses ndb_restore to impose a greater load on the cluster; if the system can handle this, restoration should complete even more quickly.--num-slices的值不直接依赖于硬件相关的值,例如 CPU 数量或 CPU 核心数、内存大小等,也不依赖于 LDM 的数量。The value of--num-slicesis not directly dependent on values relating to hardware such as number of CPUs or CPU cores, amount of RAM, and so forth, nor does it depend on the number of LDMs.在同一恢复过程中,在不同的数据节点上使用不同的此选项值是可能的;仅此本身不应产生任何不良影响。It is possible to employ different values for this option on different data nodes as part of the same restoration; doing so should not in and of itself produce any ill effects.
--parallelism=#,-p命令行格式Command-Line Format --parallelism=#类型Type 数字Numeric 默认值Default Value 128最小值Minimum Value 1最大值Maximum Value 1024ndb_restore 使用单行事务以并发方式应用多行。此参数确定 ndb_restore 实例尝试使用的并行事务(并发行)数量。默认值为 128;最小值为 1,最大值为 1024。ndb_restore uses single-row transactions to apply many rows concurrently. This parameter determines the number of parallel transactions (concurrent rows) that an instance of ndb_restore tries to use. By default, this is 128; the minimum is 1, and the maximum is 1024.
执行插入操作的工作在参与的数据节点的线程之间并行化。该机制用于从
.Data文件恢复批量数据——也就是数据的模糊快照;它不用于构建或重建索引。变更日志是串行应用的;索引删除和构建是 DDL 操作,并单独处理。恢复操作的客户端侧没有线程级并行。The work of performing the inserts is parallelized across the threads in the data nodes involved. This mechanism is employed for restoring bulk data from the.Datafile—that is, the fuzzy snapshot of the data; it is not used for building or rebuilding indexes. The change log is applied serially; index drops and builds are DDL operations and handled separately. There is no thread-level parallelism on the client side of the restore.--preserve-trailing-spaces,-P命令行格式Command-Line Format --preserve-trailing-spaces在将固定宽度的字符数据类型提升为其可变宽度等效类型时保留尾随空格——也就是说,当将
CHAR列值提升为VARCHAR,或者将BINARY列值提升为VARBINARY时。否则,当将这些列值插入到新列中时,任何尾随空格都将被删除。Cause trailing spaces to be preserved when promoting a fixed-width character data type to its variable-width equivalent—that is, when promoting aCHARcolumn value toVARCHAR, or aBINARYcolumn value toVARBINARY. Otherwise, any trailing spaces are dropped from such column values when they are inserted into the new columns.命令行格式Command-Line Format --print使 ndb_restore 将所有数据、元数据和日志打印到
stdout。等同于同时使用--print-data、--print-meta和--print-log选项。Causes ndb_restore to print all data, metadata, and logs tostdout. Equivalent to using the--print-data,--print-meta, and--print-logoptions together.Note使用
--print或任何--print_*选项实际上是在执行一次模拟运行。包含一个或多个这些选项会导致所有输出被重定向到stdout;在这种情况下,ndb_restore 不会尝试向 NDB 集群恢复数据或元数据。Use of--printor any of the--print_*options is in effect performing a dry run. Including one or more of these options causes any output to be redirected tostdout; in such cases, ndb_restore makes no attempt to restore data or metadata to an NDB Cluster.命令行格式Command-Line Format --print-data使 ndb_restore 将其输出定向到
stdout。通常与一个或多个--tab、--fields-enclosed-by、--fields-optionally-enclosed-by、--fields-terminated-by、--hex以及--append一起使用。Cause ndb_restore to direct its output tostdout. Often used together with one or more of--tab,--fields-enclosed-by,--fields-optionally-enclosed-by,--fields-terminated-by,--hex, and--append.TEXT和BLOB列值总是被截断。这些值在输出中被截断为前 256 字节。目前在使用--print-data时无法覆盖此设置。TEXTandBLOBcolumn values are always truncated. Such values are truncated to the first 256 bytes in the output. This cannot currently be overridden when using--print-data.命令行格式Command-Line Format --print-defaults打印程序参数列表然后退出。Print program argument list and exit.
命令行格式Command-Line Format --print-log让 ndb_restore 将其日志输出到
stdout。Cause ndb_restore to output its log tostdout.命令行格式Command-Line Format --print-meta将所有元数据打印到
stdout。Print all metadata tostdout.命令行格式Command-Line Format --print-sql-log将 SQL 语句记录到
stdout。使用此选项以启用;通常此行为是禁用的。该选项在尝试记录之前会检查所有正在恢复的表是否都明确定义了主键;对于仅由NDB实现的隐藏主键的表上的查询,无法转换为有效的 SQL。Log SQL statements tostdout. Use the option to enable; normally this behavior is disabled. The option checks before attempting to log whether all the tables being restored have explicitly defined primary keys; queries on a table having only the hidden primary key implemented byNDBcannot be converted to valid SQL.此选项不适用于具有
BLOB列的表。This option does not work with tables havingBLOBcolumns.命令行格式Command-Line Format --progress-frequency=#类型Type 数字Numeric 默认值Default Value 0最小值Minimum Value 0最大值Maximum Value 65535在备份进行时,每
N秒打印一次状态报告。0(默认值)表示不打印状态报告。最大值为 65535。Print a status report eachNseconds while the backup is in progress. 0 (the default) causes no status reports to be printed. The maximum is 65535.命令行格式Command-Line Format --promote-attributesndb_restore 支持有限的属性提升,方式类似于 MySQL 复制中支持的方式;也就是说,从某一类型的列备份的数据通常可以恢复到使用“更大、相似”类型的列。例如,可以将
CHAR(20)列的数据恢复到声明为VARCHAR(20)、VARCHAR(30)或CHAR(30)的列;将MEDIUMINT列的数据恢复到INT或BIGINT类型的列。有关属性提升当前支持的类型转换表,请参见 第 19.5.1.9.2 节,“不同数据类型列的复制”。ndb_restore supports limited attribute promotion in much the same way that it is supported by MySQL replication; that is, data backed up from a column of a given type can generally be restored to a column using a “larger, similar” type. For example, data from aCHAR(20)column can be restored to a column declared asVARCHAR(20),VARCHAR(30), orCHAR(30); data from aMEDIUMINTcolumn can be restored to a column of typeINTorBIGINT. See Section 19.5.1.9.2, “Replication of Columns Having Different Data Types”, for a table of type conversions currently supported by attribute promotion.此选项还可以将一个
NOT NULL列恢复为NULL。This option also makes it possible to restore aNOT NULLcolumn asNULL.必须显式启用 ndb_restore 的属性提升,如下所示:Attribute promotion by ndb_restore must be enabled explicitly, as follows:
准备要恢复备份的表。ndb_restore 不能用于以不同于原始定义的方式重新创建表;这意味着你必须要么手动创建表,要么在恢复表元数据之后但在恢复数据之前,使用
ALTER TABLE修改你希望升级的列。Prepare the table to which the backup is to be restored. ndb_restore cannot be used to re-create the table with a different definition from the original; this means that you must either create the table manually, or alter the columns which you wish to promote usingALTER TABLEafter restoring the table metadata but before restoring the data.在恢复表数据时,使用 ndb_restore 并加上
--promote-attributes选项(简写形式-A)。如果不使用此选项,将不会发生属性提升;相反,恢复操作会以错误失败。Invoke ndb_restore with the--promote-attributesoption (short form-A) when restoring the table data. Attribute promotion does not occur if this option is not used; instead, the restore operation fails with an error.
在字符数据类型与
TEXT或BLOB之间进行转换时,只能同时进行字符类型(CHAR和VARCHAR)与二进制类型(BINARY和VARBINARY)之间的转换。例如,您不能在同一次调用 ndb_restore 时,同时将INT列提升为BIGINT并将VARCHAR列提升为TEXT。When converting between character data types andTEXTorBLOB, only conversions between character types (CHARandVARCHAR) and binary types (BINARYandVARBINARY) can be performed at the same time. For example, you cannot promote anINTcolumn toBIGINTwhile promoting aVARCHARcolumn toTEXTin the same invocation of ndb_restore.不支持在使用不同字符集的
TEXT列之间进行转换,并且明确禁止这样做。Converting betweenTEXTcolumns using different character sets is not supported, and is expressly disallowed.在使用 ndb_restore 将字符或二进制类型转换为
TEXT或BLOB时,您可能会注意到它会创建并使用一个或多个名为的临时表。这些表之后不再需要,通常在成功恢复后会由 ndb_restore 删除。When performing conversions of character or binary types totable_name$STnode_idTEXTorBLOBwith ndb_restore, you may notice that it creates and uses one or more staging tables named. These tables are not needed afterwards, and are normally deleted by ndb_restore following a successful restoration.table_name$STnode_id命令行格式Command-Line Format --rebuild-indexes在恢复本地
NDB备份时启用有序索引的多线程重建。使用此选项时,由 ndb_restore 构建有序索引的线程数量由BuildIndexThreads数据节点配置参数以及 LDM 数量控制。Enable multithreaded rebuilding of the ordered indexes while restoring a nativeNDBbackup. The number of threads used for building ordered indexes by ndb_restore with this option is controlled by theBuildIndexThreadsdata node configuration parameter and the number of LDMs.仅在首次运行 ndb_restore 时才有必要使用此选项;这会导致所有有序索引在恢复后续节点时重建,而无需再次使用
--rebuild-indexes。你应该在向数据库插入新行之前使用此选项;否则,有可能插入的某行在稍后尝试重建索引时导致唯一约束冲突。It is necessary to use this option only for the first run of ndb_restore; this causes all ordered indexes to be rebuilt without using--rebuild-indexesagain when restoring subsequent nodes. You should use this option prior to inserting new rows into the database; otherwise, it is possible for a row to be inserted that later causes a unique constraint violation when trying to rebuild the indexes.默认情况下,有序索引的构建会根据 LDM 的数量并行化。在节点和系统重启期间执行的离线索引构建可以使用
BuildIndexThreads数据节点配置参数加快;该参数对在线执行的 ndb_restore 删除和重建索引无效。Building of ordered indices is parallelized with the number of LDMs by default. Offline index builds performed during node and system restarts can be made faster using theBuildIndexThreadsdata node configuration parameter; this parameter has no effect on dropping and rebuilding of indexes by ndb_restore, which is performed online.重建唯一索引会使用磁盘写入带宽用于重做日志记录和本地检查点。如果该带宽不足,可能会导致重做缓冲区过载或日志过载错误。在这种情况下,您可以再次运行 ndb_restore
--rebuild-indexes;该过程会从错误发生的点继续。您也可以在遇到临时错误时执行此操作。您可以无限次重复执行 ndb_restore--rebuild-indexes;通过降低--parallelism的值,您可能能够阻止此类错误。如果问题是空间不足,您可以增加重做日志的大小(FragmentLogFileSize节点配置参数),或者可以增加执行 LCP 的速度(MaxDiskWriteSpeed及相关参数),以便更快释放空间。Rebuilding of unique indexes uses disk write bandwidth for redo logging and local checkpointing. An insufficient amount of this bandwidth can lead to redo buffer overload or log overload errors. In such cases you can run ndb_restore--rebuild-indexesagain; the process resumes at the point where the error occurred. You can also do this when you have encountered temporary errors. You can repeat execution of ndb_restore--rebuild-indexesindefinitely; you may be able to stop such errors by reducing the value of--parallelism. If the problem is insufficient space, you can increase the size of the redo log (FragmentLogFileSizenode configuration parameter), or you can increase the speed at which LCPs are performed (MaxDiskWriteSpeedand related parameters), in order to free space more quickly.--remap-column=db.tbl.col:fn:args命令行格式Command-Line Format --remap-column=string类型Type 字符串String 默认值Default Value [none][none]与
--restore-data一起使用时,此选项会将函数应用于指定列的值。参数字符串中的值列在这里:When used together with--restore-data, this option applies a function to the value of the indicated column. Values in the argument string are listed here:db:数据库名称,遵循--rewrite-database执行的任何重命名。db: Database name, following any renames performed by--rewrite-database.tbl:表名称。tbl: Table name.col:要更新的列名称。该列必须是INT或BIGINT类型。该列也可以是但不要求为UNSIGNED。col: Name of the column to be updated. This column must be of typeINTorBIGINT. The column can also be but is not required to beUNSIGNED.fn:函数名称;目前,唯一支持的名称是offset。fn: Function name; currently, the only supported name isoffset.args:传递给函数的参数。目前,只支持单个参数,即由offset函数添加的偏移量的大小。支持负值。参数的大小不能超过列类型的有符号变体的大小;例如,如果col是一个INT列,则传递给offset函数的参数允许范围是-2147483648到2147483647(参见 第 13.1.2 节,“整数类型(精确值)- INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT”)。args: Arguments supplied to the function. Currently, only a single argument, the size of the offset to be added by theoffsetfunction, is supported. Negative values are supported. The size of the argument cannot exceed that of the signed variant of the column's type; for example, ifcolis anINTcolumn, then the allowed range of the argument passed to theoffsetfunction is-2147483648to2147483647(see Section 13.1.2, “Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT”).如果将偏移值应用到列会导致溢出或下溢,则恢复操作会失败。例如,如果该列是
BIGINT类型,而该选项尝试对该列值为 4294967291 的行应用偏移值 8,就会发生这种情况,因为4294967291 + 8 = 4294967299 > 4294967295。If applying the offset value to the column would cause an overflow or underflow, the restore operation fails. This could happen, for example, if the column is aBIGINT, and the option attempts to apply an offset value of 8 on a row in which the column value is 4294967291, since4294967291 + 8 = 4294967299 > 4294967295.
This option can be useful when you wish to merge data stored in multiple source instances of NDB Cluster (all using the same schema) into a single destination NDB Cluster, using NDB native backup (see Section 25.6.8.2, “Using The NDB Cluster Management Client to Create a Backup”) and ndb_restore to merge the data, where primary and unique key values are overlapping between source clusters, and it is necessary as part of the process to remap these values to ranges that do not overlap. It may also be necessary to preserve other relationships between tables. To fulfill such requirements, it is possible to use the option multiple times in the same invocation of ndb_restore to remap columns of different tables, as shown here:
$>
ndb_restore --restore-data --remap-column=hr.employee.id:offset:1000 \ --remap-column=hr.manager.id:offset:1000 --remap-column=hr.firstaiders.id:offset:1000(这里未显示的其他选项也可以使用。)(Other options not shown here may also be used.)
--remap-column也可以用于更新同一表的多个列。可以组合多个表和列的操作。不同的列也可以使用不同的偏移值,如下所示:--remap-columncan also be used to update multiple columns of the same table. Combinations of multiple tables and columns are possible. Different offset values can also be used for different columns of the same table, like this:$>
ndb_restore --restore-data --remap-column=hr.employee.salary:offset:10000 \ --remap-column=hr.employee.hours:offset:-10当源备份包含不应合并的重复表时,可以使用
--exclude-tables、--exclude-databases,或者通过应用程序中的其他方式来处理。When source backups contain duplicate tables which should not be merged, you can handle this by using--exclude-tables,--exclude-databases, or by some other means in your application.可以使用
SHOW CREATE TABLE、ndb_desc 工具,以及MAX()、MIN()、LAST_INSERT_ID()和其他 MySQL 函数,获取要合并的表的结构和其他特性信息。Information about the structure and other characteristics of tables to be merged can obtained usingSHOW CREATE TABLE; the ndb_desc tool; andMAX(),MIN(),LAST_INSERT_ID(), and other MySQL functions.在 NDB Cluster 的不同实例中,不支持将已合并表的变更复制到未合并表,或将未合并表的变更复制到已合并表。Replication of changes from merged to unmerged tables, or from unmerged to merged tables, in separate instances of NDB Cluster is not supported.
--restore-data,-r命令行格式Command-Line Format --restore-data--restore-epoch,-e命令行格式Command-Line Format --restore-epoch向集群复制状态表添加(或恢复)epoch 信息。这对于在 NDB 集群副本上启动复制非常有用。当使用此选项时,如果
mysql.ndb_apply_status表中id列为0的行已存在,则对其进行更新;如果该行不存在,则插入该行。(见第 25.7.9 节,“具有 NDB 集群复制的 NDB 集群备份”。)Add (or restore) epoch information to the cluster replication status table. This is useful for starting replication on an NDB Cluster replica. When this option is used, the row in themysql.ndb_apply_statushaving0in theidcolumn is updated if it already exists; such a row is inserted if it does not already exist. (See Section 25.7.9, “NDB Cluster Backups With NDB Cluster Replication”.)--restore-meta,-m命令行格式Command-Line Format --restore-meta此选项会使 ndb_restore 打印
NDB表元数据。This option causes ndb_restore to printNDBtable metadata.第一次运行 ndb_restore 恢复程序时,你还需要恢复元数据。换句话说,你必须重新创建表——这可以通过使用
--restore-meta(-m) 选项运行来完成。元数据的恢复只需在单个数据节点上进行,这就足以将其恢复到整个集群。The first time you run the ndb_restore restoration program, you also need to restore the metadata. In other words, you must re-create the database tables—this can be done by running it with the--restore-meta(-m) option. Restoring the metadata need be done only on a single data node; this is sufficient to restore it to the entire cluster.ndb_restore 使用目标集群的默认分区数,除非本地数据管理器线程数也从原集群的数据节点设置修改过。ndb_restore uses the default number of partitions for the target cluster, unless the number of local data manager threads is also changed from what it was for data nodes in the original cluster.
使用此选项时,建议通过设置
ndb_metadata_check=OFF禁用自动同步,直到 ndb_restore 完成元数据恢复,然后可以重新启用它以同步 NDB 字典中新创建的对象。When using this option, it is recommended that auto synchronization be disabled by settingndb_metadata_check=OFFuntil ndb_restore has completed restoring the metadata, after which it can it turned on again to synchronize objects newly created in the NDB dictionary.命令行格式Command-Line Format --restore-privilege-tables已弃用Deprecated 是Yes 不再使用。No longer used.
--rewrite-database=olddb,newdb命令行格式Command-Line Format --rewrite-database=string类型Type 字符串String 默认值Default Value nonenone此选项可以将数据恢复到名称与备份中使用的名称不同的数据库。例如,如果对名为
products的数据库进行了备份,您可以将其包含的数据恢复到名为inventory的数据库中,如下所示使用此选项(省略可能需要的其他选项):This option makes it possible to restore to a database having a different name from that used in the backup. For example, if a backup is made of a database namedproducts, you can restore the data it contains to a database namedinventory, use this option as shown here (omitting any other options that might be required):$> ndb_restore --rewrite-database=product,inventory
该选项可以在单次调用 ndb_restore 时使用多次。因此,可以使用
db1同时将名为db2的数据库恢复到名为db3的数据库,并将名为db4的数据库恢复到名为--rewrite-database=db1,db2 --rewrite-database=db3,db4的数据库。在多次出现的--rewrite-database之间,还可以使用其他 ndb_restore 选项。The option can be employed multiple times in a single invocation of ndb_restore. Thus it is possible to restore simultaneously from a database nameddb1to a database nameddb2and from a database nameddb3to one nameddb4using--rewrite-database=db1,db2 --rewrite-database=db3,db4. Other ndb_restore options may be used between multiple occurrences of--rewrite-database.在多个
--rewrite-database选项之间发生冲突的情况下,从左到右使用的最后一个--rewrite-database选项将生效。例如,如果使用--rewrite-database=db1,db2 --rewrite-database=db1,db3,则仅--rewrite-database=db1,db3会被采纳,而--rewrite-database=db1,db2将被忽略。也可以将多个数据库恢复到同一个数据库,因此--rewrite-database=db1,db3 --rewrite-database=db2,db3会将数据库db1和db2的所有表和数据恢复到数据库db3。In the event of conflicts between multiple--rewrite-databaseoptions, the last--rewrite-databaseoption used, reading from left to right, is the one that takes effect. For example, if--rewrite-database=db1,db2 --rewrite-database=db1,db3is used, only--rewrite-database=db1,db3is honored, and--rewrite-database=db1,db2is ignored. It is also possible to restore from multiple databases to a single database, so that--rewrite-database=db1,db3 --rewrite-database=db2,db3restores all tables and data from databasesdb1anddb2into databasedb3.Important当使用
--rewrite-database从多个备份数据库恢复到单个目标数据库时,不会检查表或其他对象名称之间的冲突,并且恢复行的顺序无法保证。这意味着在这种情况下,行可能会被覆盖,更新可能会丢失。When restoring from multiple backup databases into a single target database using--rewrite-database, no check is made for collisions between table or other object names, and the order in which rows are restored is not guaranteed. This means that it is possible in such cases for rows to be overwritten and updates to be lost.命令行格式Command-Line Format --skip-broken-objects此选项会导致 ndb_restore 在读取原生
NDB备份时忽略损坏的表,并继续恢复任何剩余的表(没有损坏的表)。当前,--skip-broken-objects选项仅在缺少 blob 部件表的情况下有效。This option causes ndb_restore to ignore corrupt tables while reading a nativeNDBbackup, and to continue restoring any remaining tables (that are not also corrupted). Currently, the--skip-broken-objectsoption works only in the case of missing blob parts tables.命令行格式Command-Line Format --skip-fk-checks此选项修改ndb_restore
--rebuild-indexes的行为,以便在重新启用外键时,不检查表中现有数据的一致性。This option modifies the behavior of ndb_restore--rebuild-indexesso that, when foreign keys are re-enabled, the existing data in the table is not checked for consistency.命令行格式Command-Line Format --skip-table-check可以在不恢复表元数据的情况下恢复数据。默认情况下,在执行此操作时,如果表数据与表模式不匹配,ndb_restore 会因错误而失败;此选项会覆盖该行为。It is possible to restore data without restoring table metadata. By default when doing this, ndb_restore fails with an error if a mismatch is found between the table data and the table schema; this option overrides that behavior.
在使用ndb_restore恢复数据时,对列定义不匹配的一些限制有所放宽;当遇到这些类型的不匹配时,ndb_restore不会像以前那样立即报错停止,而是接受数据并将其插入目标表,同时向用户发出警告,提示正在进行此操作。无论是否使用
--skip-table-check选项或--promote-attributes选项,此行为都会发生。列定义的这些差异类型如下:Some of the restrictions on mismatches in column definitions when restoring data using ndb_restore are relaxed; when one of these types of mismatches is encountered, ndb_restore does not stop with an error as it did previously, but rather accepts the data and inserts it into the target table while issuing a warning to the user that this is being done. This behavior occurs whether or not either of the options--skip-table-checkor--promote-attributesis in use. These differences in column definitions are of the following types:不同的
COLUMN_FORMAT设置(FIXED、DYNAMIC、DEFAULT)DifferentCOLUMN_FORMATsettings (FIXED,DYNAMIC,DEFAULT)不同的
STORAGE设置(MEMORY、DISK)DifferentSTORAGEsettings (MEMORY,DISK)不同的默认值Different default values
不同的分布键设置Different distribution key settings
命令行格式Command-Line Format --skip-unknown-objects此选项使 ndb_restore 在读取本地
NDB备份时忽略其不识别的任何模式对象。这可以用于将来自运行(例如)NDB 7.6 的集群的备份恢复到运行 NDB 集群 7.5 的集群。This option causes ndb_restore to ignore any schema objects it does not recognize while reading a nativeNDBbackup. This can be used for restoring a backup made from a cluster running (for example) NDB 7.6 to a cluster running NDB Cluster 7.5.命令行格式Command-Line Format --slice-id=#类型Type 整数Integer 默认值Default Value 0最小值Minimum Value 0最大值Maximum Value 1023在按片恢复时,这是要恢复的片的 ID。此选项总是与
--num-slices一起使用,其值必须始终小于--num-slices的值。When restoring by slices, this is the ID of the slice to restore. This option is always used together with--num-slices, and its value must be always less than that of--num-slices.有关更多信息,请参见本节其他地方对
--num-slices的描述。For more information, see the description of the--num-sliceselsewhere in this section.--tab=dir_name,-Tdir_name命令行格式Command-Line Format --tab=path类型Type 目录名称Directory name 使
--print-data创建转储文件,每个表一个文件,每个文件命名为。它需要一个参数,即要保存文件的目录路径;使用tbl_name.txt.表示当前目录。Causes--print-datato create dump files, one per table, each named. It requires as its argument the path to the directory where the files should be saved; usetbl_name.txt.for the current directory.命令行格式Command-Line Format --timestamp-printouts{=true|false}类型Type 布尔Boolean 默认值Default Value truetrue使信息、错误和调试日志消息带有时间戳前缀。Causes info, error, and debug log messages to be prefixed with timestamps.
此选项默认启用。使用
--timestamp-printouts=false可禁用。This option is enabled by default. Disable it with--timestamp-printouts=false.命令行格式Command-Line Format --usage显示帮助文本并退出;与
--help相同。Display help text and exit; same as--help.命令行格式Command-Line Format --verbose=#类型Type 数字Numeric 默认值Default Value 1最小值Minimum Value 0最大值Maximum Value 255设置输出的详细程度。最小值为 0;最大值为 255。默认值为 1。Sets the level for the verbosity of the output. The minimum is 0; the maximum is 255. The default value is 1.
命令行格式Command-Line Format --version显示版本信息并退出。Display version information and exit.
命令行格式Command-Line Format --with-apply-status从备份的
ndb_apply_status表中恢复所有行(除server_id = 0的行外,该行是使用--restore-epoch生成的)。此选项需要同时使用--restore-data。Restore all rows from the backup'sndb_apply_statustable (except for the row havingserver_id = 0, which is generated using--restore-epoch). This option requires that--restore-dataalso be used.如果备份中的
ndb_apply_status表已经包含server_id = 0的行,ndb_restore--with-apply-status会将其删除。因此,我们建议在使用 ndb_restore--with-apply-status选项恢复后,再使用 ndb_restore--restore-epoch。你也可以在任何一次使用 ndb_restore--with-apply-status恢复集群的最后一次调用时,同时使用--restore-epoch。If thendb_apply_statustable from the backup already contains a row withserver_id = 0, ndb_restore--with-apply-statusdeletes it. For this reason, we recommend that you use ndb_restore--restore-epochafter invoking ndb_restore with the--with-apply-statusoption. You can also use--restore-epochconcurrently with the last of any invocations of ndb_restore--with-apply-statusused to restore the cluster.欲了解更多信息,请参见 ndb_apply_status 表。For more information, see ndb_apply_status Table.
此实用程序的典型选项如下所示:Typical options for this utility are shown here:
ndb_restore [-cconnection_string] -nnode_id-bbackup_id\ [-m] -r --backup-path=/path/to/backup/files
通常,在从 NDB 集群备份恢复时,ndb_restore 至少需要 --nodeid(简称:-n)、--backupid(简称:-b)和 --backup-path 选项。Normally, when restoring from an NDB Cluster backup,
ndb_restore requires at a minimum the
--nodeid (short form:
-n),
--backupid (short form:
-b), and
--backup-path options.
-c 选项用于指定连接字符串,该字符串告诉 ndb_restore 在哪里找到集群管理服务器(参见 第 25.4.3.3 节,“NDB 集群连接字符串”)。如果未使用此选项,则 ndb_restore 会尝试连接到 localhost:1186 的管理服务器。该实用程序作为集群 API 节点运行,因此需要一个空闲连接“槽”来连接到集群管理服务器。这意味着集群 config.ini 文件中至少必须有一个 [api] 或 [mysqld] 节可供其使用。因此,建议在 config.ini 中保留至少一个未用于 MySQL 服务器或其他应用程序的空闲 [api] 或 [mysqld] 节(参见 第 25.4.3.7 节,“在 NDB 集群中定义 SQL 和其他 API 节点”)。The -c option is used to specify a connection
string which tells ndb_restore where to
locate the cluster management server (see
Section 25.4.3.3, “NDB Cluster Connection Strings”). If this
option is not used, then ndb_restore attempts
to connect to a management server on
localhost:1186. This utility acts as a
cluster API node, and so requires a free connection
“slot” to connect to the cluster management server.
This means that there must be at least one
[api] or [mysqld] section
that can be used by it in the cluster
config.ini file. It is a good idea to keep
at least one empty [api] or
[mysqld] section in
config.ini that is not being used for a
MySQL server or other application for this reason (see
Section 25.4.3.7, “Defining SQL and Other API Nodes in an NDB Cluster”).
ndb_restore 可以使用 --decrypt 和 --backup-password 解密加密备份。必须同时指定这两个选项才能执行解密。有关创建加密备份的信息,请参阅 START
BACKUP 管理客户端命令的文档。ndb_restore can decrypt an encrypted backup
using --decrypt and
--backup-password. Both
options must be specified to perform decryption. See the
documentation for the START
BACKUP management client command for information on
creating encrypted backups.
您可以通过在 ndb_mgm 管理客户端中使用 SHOW 命令来验证 ndb_restore 是否已连接到集群。您也可以像这里显示的一样,从系统 shell 完成此操作:You can verify that ndb_restore is connected
to the cluster by using the
SHOW command in the
ndb_mgm management client. You can also
accomplish this from a system shell, as shown here:
$> ndb_mgm -e "SHOW"
错误报告。 ndb_restore 会报告临时和永久错误。在临时错误的情况下,它可能能够从中恢复,并在这种情况下报告 Restore successful,
but encountered temporary error, please look at
configuration。Error reporting.
ndb_restore reports both temporary and
permanent errors. In the case of temporary errors, it may able
to recover from them, and reports Restore successful,
but encountered temporary error, please look at
configuration in such cases.
在使用 ndb_restore 初始化 NDB Cluster 以用于循环复制后,充当副本的 SQL 节点上的二进制日志不会自动创建,必须手动创建它们。要创建二进制日志,请在该 SQL 节点上运行 SHOW TABLES 语句,然后再运行 START
REPLICA。这是 NDB Cluster 中的一个已知问题。After using ndb_restore to initialize an
NDB Cluster for use in circular replication, binary logs on
the SQL node acting as the replica are not automatically
created, and you must cause them to be created manually. To
cause the binary logs to be created, issue a
SHOW TABLES statement on that
SQL node before running START
REPLICA. This is a known issue in NDB Cluster.