MySQL 8.0 Reference Manual Including MySQL NDB Cluster 8.0

22.4.23 ndb_restore — Restore an NDB Cluster Backup

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.

Note

Beginning with NDB 8.0.17, this program no longer prints NDBT_ProgramExit: ... when it finishes its run. Applications depending on this behavior should be modified accordingly when upgrading from NDB 8.0.16 or earlier to a NDB 8.0 later release.

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

Note

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 22.5.8, “NDB Cluster Single User Mode”, for more information.

The following table includes options that are specific to the NDB Cluster native backup restoration program ndb_restore. Additional descriptions follow the table. For options common to most NDB Cluster programs (including ndb_restore), see Section 22.4.31, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.

Table 22.350 Command-line options for the ndb_restore program

Format Description Added, Deprecated, or Removed

--append

Append data to a tab-delimited file

All NDB 8.0 releases

--backup_path=dir_name

Path to backup files directory

All NDB 8.0 releases

--backupid=#,

-b

Restore from the backup with the given ID

All NDB 8.0 releases

--connect,

-c

Alias for --connectstring.

All NDB 8.0 releases

--disable-indexes

Causes indexes from a backup to be ignored; may decrease time needed to restore data.

All NDB 8.0 releases

--dont-ignore-systab-0,

-f

Do not ignore system table during restore. Experimental only; not for production use

All NDB 8.0 releases

--exclude-databases=db-list

List of one or more databases to exclude (includes those not named)

All NDB 8.0 releases

--exclude-intermediate-sql-tables[=TRUE|FALSE]

If TRUE (the default), do not restore any intermediate tables (having names prefixed with '#sql-') that were left over from copying ALTER TABLE operations.

All NDB 8.0 releases

--exclude-missing-columns

Causes columns from the backup version of a table that are missing from the version of the table in the database to be ignored.

All NDB 8.0 releases

--exclude-missing-tables

Causes tables from the backup that are missing from the database to be ignored.

All NDB 8.0 releases

--exclude-tables=table-list

List of one or more tables to exclude (includes those in the same database that are not named); each table reference must include the database name

All NDB 8.0 releases

--fields-enclosed-by=char

Fields are enclosed with the indicated character

All NDB 8.0 releases

--fields-optionally-enclosed-by

Fields are optionally enclosed with the indicated character

All NDB 8.0 releases

--fields-terminated-by=char

Fields are terminated by the indicated character

All NDB 8.0 releases

--hex

Print binary types in hexadecimal format

All NDB 8.0 releases

--include-databases=db-list

List of one or more databases to restore (excludes those not named)

All NDB 8.0 releases

--include-tables=table-list

List of one or more tables to restore (excludes those in same database that are not named); each table reference must include the database name

All NDB 8.0 releases

--lines-terminated-by=char

Lines are terminated by the indicated character

All NDB 8.0 releases

--lossy-conversions,

-L

Allow lossy conversions of column values (type demotions or changes in sign) when restoring data from backup

All NDB 8.0 releases

--no-binlog

If a mysqld is connected and using binary logging, do not log the restored data

All NDB 8.0 releases

--no-restore-disk-objects,

-d

Do not restore objects relating to Disk Data

All NDB 8.0 releases

--no-upgrade,

-u

Do not upgrade array type for varsize attributes which do not already resize VAR data, and do not change column attributes

All NDB 8.0 releases

--ndb-nodegroup-map=map,

-z

Nodegroup map for NDBCLUSTER storage engine. Syntax: list of (source_nodegroup, destination_nodegroup)

All NDB 8.0 releases

--nodeid=#,

-n

ID of node where backup was taken

All NDB 8.0 releases

--parallelism=#,

-p

Number of parallel transactions to use while restoring data

All NDB 8.0 releases

--preserve-trailing-spaces,

-P

Allow preservation of trailing spaces (including padding) when promoting fixed-width string types to variable-width types

All NDB 8.0 releases

--print

Print metadata, data and log to stdout (equivalent to --print-meta --print-data --print-log)

All NDB 8.0 releases

--print-data

Print data to stdout

All NDB 8.0 releases

--print-log

Print to stdout

All NDB 8.0 releases

--print-meta

Print metadata to stdout

All NDB 8.0 releases

print-sql-log

Write SQL log to stdout; default is FALSE

All NDB 8.0 releases

--progress-frequency=#

Print status of restoration each given number of seconds

All NDB 8.0 releases

--promote-attributes,

-A

Allow attributes to be promoted when restoring data from backup

All NDB 8.0 releases

--rebuild-indexes

Causes multithreaded rebuilding of ordered indexes found in the backup. Number of threads used is determined by setting BuildIndexThreads parameter.

All NDB 8.0 releases

--restore-data,

-r

Restore table data and logs into NDB Cluster using the NDB API

All NDB 8.0 releases

--restore-epoch,

-e

Restore epoch info into the status table. Convenient on a MySQL Cluster replication slave for starting replication. The row in mysql.ndb_apply_status with id 0 will be updated/inserted.

All NDB 8.0 releases

--restore-meta,

-m

Restore metadata to NDB Cluster using the NDB API

All NDB 8.0 releases

--restore-privilege-tables

Restore MySQL privilege tables that were previously moved to NDB.

All NDB 8.0 releases

--rewrite-database=olddb,newdb

Restores to a database with a different name than the original

All NDB 8.0 releases

--skip-broken-objects

Causes missing blob tables in the backup file to be ignored.

All NDB 8.0 releases

--skip-table-check,

-s

Skip table structure check during restoring of data

All NDB 8.0 releases

--skip-unknown-objects

Causes schema objects not recognized by ndb_restore to be ignored when restoring a backup made from a newer MySQL Cluster version to an older version.

All NDB 8.0 releases

--tab=dir_name,

-T dir_name

Creates a tab-separated .txt file for each table in the given path

All NDB 8.0 releases

--verbose=#

Level of verbosity in output

All NDB 8.0 releases


Typical options for this utility are shown here:

ndb_restore [-c connection_string] -n node_id -b backup_id \
      [-m] -r --backup_path=/path/to/backup/files

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. In addition, when ndb_restore is used to restore any tables containing unique indexes, you must include --disable-indexes or --rebuild-indexes. (Bug #57782, Bug #11764893)

The -c option is used to specify a connection string which tells ndb_restore where to locate the cluster management server (see Section 22.3.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 22.3.3.7, “Defining SQL and Other API Nodes in an NDB Cluster”).

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:

shell> ndb_mgm -e "SHOW"

More detailed information about all options used by ndb_restore can be found in the following list:

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.

Important

After using ndb_restore to initialize an NDB Cluster for use in circular replication, binary logs on the SQL node acting as the replication slave 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 SLAVE. This is a known issue in NDB Cluster.