MySQL 5.6 Reference Manual Including MySQL NDB Cluster 7.3-7.4 Reference Guide

18.4.22 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 7.3.25 and 7.4.24, this program no longer prints NDBT_ProgramExit: ... when it finishes its run. Applications depending on this behavior should be modified accordingly when upgrading from earlier releases.

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

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 18.5.6, “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 18.4.29, “Options Common to NDB Cluster Programs — Options Common to NDB Cluster Programs”.

Table 18.32 Command-line options for the ndb_restore program

Format Description Added, Deprecated, or Removed

--append

Append data to tab-delimited file

(Supported in all MySQL 5.6 based releases)

--backup-path=dir_name

Path to backup files directory

(Supported in all MySQL 5.6 based releases)

--backupid=#,

-b

Restore from backup having this ID

(Supported in all MySQL 5.6 based releases)

--connect,

-c

Alias for --connectstring

(Supported in all MySQL 5.6 based releases)

--disable-indexes

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

(Supported in all MySQL 5.6 based releases)

--dont-ignore-systab-0,

-f

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

(Supported in all MySQL 5.6 based releases)

--exclude-databases=db-list

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

(Supported in all MySQL 5.6 based releases)

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

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

ADDED: NDB 7.3.6

--exclude-missing-columns

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

(Supported in all MySQL 5.6 based releases)

--exclude-missing-tables

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

ADDED: NDB 7.3.7

--exclude-tables=table-list

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

(Supported in all MySQL 5.6 based releases)

--fields-enclosed-by=char

Fields are enclosed by this character

(Supported in all MySQL 5.6 based releases)

--fields-optionally-enclosed-by

Fields are optionally enclosed by this character

(Supported in all MySQL 5.6 based releases)

--fields-terminated-by=char

Fields are terminated by this character

(Supported in all MySQL 5.6 based releases)

--hex

Print binary types in hexadecimal format

(Supported in all MySQL 5.6 based releases)

--include-databases=db-list

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

(Supported in all MySQL 5.6 based 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 database name

(Supported in all MySQL 5.6 based releases)

--lines-terminated-by=char

Lines are terminated by this character

(Supported in all MySQL 5.6 based releases)

--lossy-conversions,

-L

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

(Supported in all MySQL 5.6 based releases)

--no-binlog

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

(Supported in all MySQL 5.6 based releases)

--no-restore-disk-objects,

-d

Do not restore objects relating to Disk Data

(Supported in all MySQL 5.6 based 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

(Supported in all MySQL 5.6 based releases)

--ndb-nodegroup-map=map,

-z

Nodegroup map for NDBCLUSTER storage engine; syntax: list of (source_nodegroup, destination_nodegroup)

(Supported in all MySQL 5.6 based releases)

--nodeid=#,

-n

ID of node where backup was taken

(Supported in all MySQL 5.6 based releases)

--parallelism=#,

-p

Number of parallel transactions to use while restoring data

(Supported in all MySQL 5.6 based releases)

--preserve-trailing-spaces,

-P

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

(Supported in all MySQL 5.6 based releases)

--print

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

(Supported in all MySQL 5.6 based releases)

--print-data

Print data to stdout

(Supported in all MySQL 5.6 based releases)

--print-log

Print log to stdout

(Supported in all MySQL 5.6 based releases)

--print-meta

Print metadata to stdout

(Supported in all MySQL 5.6 based releases)

--progress-frequency=#

Print status of restore each given number of seconds

(Supported in all MySQL 5.6 based releases)

--promote-attributes,

-A

Allow attributes to be promoted when restoring data from backup

(Supported in all MySQL 5.6 based releases)

--rebuild-indexes

Causes multithreaded rebuilding of ordered indexes found in backup; number of threads used is determined by setting BuildIndexThreads

(Supported in all MySQL 5.6 based releases)

--restore-data,

-r

Restore table data and logs into NDB Cluster using NDB API

(Supported in all MySQL 5.6 based releases)

--restore-epoch,

-e

Restore epoch info into status table; useful on replica cluster for starting replication; updates or inserts row in mysql.ndb_apply_status with ID 0

(Supported in all MySQL 5.6 based releases)

--restore-meta,

-m

Restore metadata to NDB Cluster using NDB API

(Supported in all MySQL 5.6 based releases)

--restore-privilege-tables

Restore MySQL privilege tables that were previously moved to NDB

(Supported in all MySQL 5.6 based releases)

--rewrite-database=olddb,newdb

Restore to differently named database

(Supported in all MySQL 5.6 based releases)

--skip-broken-objects

Ignore missing blob tables in backup file

(Supported in all MySQL 5.6 based releases)

--skip-table-check,

-s

Skip table structure check during restore

(Supported in all MySQL 5.6 based releases)

--skip-unknown-objects

Causes schema objects not recognized by ndb_restore to be ignored when restoring backup made from newer NDB version to older version

(Supported in all MySQL 5.6 based releases)

--tab=dir_name,

-T dir_name

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

(Supported in all MySQL 5.6 based releases)

--verbose=#

Level of verbosity in output

(Supported in all MySQL 5.6 based 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 18.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 18.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"
Note

In NDB 7.3.11 and NDB 7.4.8 only, when ndb_restore is used to restore any tables containing unique indexes, you must include --disable-indexes or --rebuild-indexes. (Bug #57782, Bug #11764893) This is not a requirement in later versions. (Bug #22345748)

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 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 SLAVE. This is a known issue in NDB Cluster.