MySQL 8.0 Reference Manual Including MySQL NDB Cluster 8.0

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

In NDB 7.6 and earlier, this program printed NDBT_ProgramExit - status upon completion of its run, due to an unnecessary dependency on the NDBT testing library. This dependency has been removed in NDB 8.0, eliminating the extraneous output.

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.

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

Options that can be used with ndb_restore are shown in the following table. Additional descriptions follow the table.

Table 25.42 Command-line options used with the program ndb_restore

Format Description Added, Deprecated, or Removed

--allow-pk-changes[=0|1]

Allow changes to set of columns making up table's primary key

ADDED: NDB 8.0.21

--append

Append data to tab-delimited file

(Supported in all NDB releases based on MySQL 8.0)

--backup-password=password

Supply a password for decrypting an encrypted backup with --decrypt; see documentation for allowed values

ADDED: NDB 8.0.22

--backup-password-from-stdin

Get decryption password in a secure fashion from STDIN; use together with --decrypt option

ADDED: NDB 8.0.24

--backup-path=path

Path to backup files directory

(Supported in all NDB releases based on MySQL 8.0)

--backupid=#,

-b #

Restore from backup having this ID

(Supported in all NDB releases based on MySQL 8.0)

--character-sets-dir=path

Directory containing character sets

REMOVED: 8.0.31

--connect=connection_string,

-c connection_string

Alias for --connectstring

(Supported in all NDB releases based on MySQL 8.0)

--connect-retries=#

Number of times to retry connection before giving up

(Supported in all NDB releases based on MySQL 8.0)

--connect-retry-delay=#

Number of seconds to wait between attempts to contact management server

(Supported in all NDB releases based on MySQL 8.0)

--connect-string=connection_string,

-c connection_string

Same as --ndb-connectstring

(Supported in all NDB releases based on MySQL 8.0)

--core-file

Write core file on error; used in debugging

(Supported in all NDB releases based on MySQL 8.0)

--decrypt

Decrypt an encrypted backup; requires --backup-password

ADDED: NDB 8.0.22

--defaults-extra-file=path

Read given file after global files are read

(Supported in all NDB releases based on MySQL 8.0)

--defaults-file=path

Read default options from given file only

(Supported in all NDB releases based on MySQL 8.0)

--defaults-group-suffix=string

Also read groups with concat(group, suffix)

(Supported in all NDB releases based on MySQL 8.0)

--disable-indexes

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

(Supported in all NDB releases based on MySQL 8.0)

--dont-ignore-systab-0,

-f

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

(Supported in all NDB releases based on MySQL 8.0)

--exclude-databases=list

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

(Supported in all NDB releases based on MySQL 8.0)

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

Do not restore any intermediate tables (having names prefixed with '#sql-') that were left over from copying ALTER TABLE operations; specify FALSE to restore such tables

(Supported in all NDB releases based on MySQL 8.0)

--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 NDB releases based on MySQL 8.0)

--exclude-missing-tables

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

(Supported in all NDB releases based on MySQL 8.0)

--exclude-tables=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 NDB releases based on MySQL 8.0)

--fields-enclosed-by=char

Fields are enclosed by this character

(Supported in all NDB releases based on MySQL 8.0)

--fields-optionally-enclosed-by

Fields are optionally enclosed by this character

(Supported in all NDB releases based on MySQL 8.0)

--fields-terminated-by=char

Fields are terminated by this character

(Supported in all NDB releases based on MySQL 8.0)

--help,

-?

Display help text and exit

(Supported in all NDB releases based on MySQL 8.0)

--hex

Print binary types in hexadecimal format

(Supported in all NDB releases based on MySQL 8.0)

--ignore-extended-pk-updates[=0|1]

Ignore log entries containing updates to columns now included in extended primary key

ADDED: NDB 8.0.21

--include-databases=list

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

(Supported in all NDB releases based on MySQL 8.0)

--include-stored-grants

Restore shared users and grants to ndb_sql_metadata table

ADDED: NDB 8.0.19

--include-tables=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 NDB releases based on MySQL 8.0)

--lines-terminated-by=char

Lines are terminated by this character

(Supported in all NDB releases based on MySQL 8.0)

--login-path=path

Read given path from login file

(Supported in all NDB releases based on MySQL 8.0)

--lossy-conversions,

-L

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

(Supported in all NDB releases based on MySQL 8.0)

--no-binlog

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

(Supported in all NDB releases based on MySQL 8.0)

--no-defaults

Do not read default options from any option file other than login file

(Supported in all NDB releases based on MySQL 8.0)

--no-restore-disk-objects,

-d

Do not restore objects relating to Disk Data

(Supported in all NDB releases based on MySQL 8.0)

--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 NDB releases based on MySQL 8.0)

--ndb-connectstring=connection_string,

-c connection_string

Set connect string for connecting to ndb_mgmd. Syntax: "[nodeid=id;][host=]hostname[:port]". Overrides entries in NDB_CONNECTSTRING and my.cnf

(Supported in all NDB releases based on MySQL 8.0)

--ndb-mgmd-host=connection_string,

-c connection_string

Same as --ndb-connectstring

(Supported in all NDB releases based on MySQL 8.0)

--ndb-nodegroup-map=map,

-z

Specify node group map; unused, unsupported

(Supported in all NDB releases based on MySQL 8.0)

--ndb-nodeid=#

Set node ID for this node, overriding any ID set by --ndb-connectstring

(Supported in all NDB releases based on MySQL 8.0)

--ndb-optimized-node-selection

Enable optimizations for selection of nodes for transactions. Enabled by default; use --skip-ndb-optimized-node-selection to disable

REMOVED: 8.0.31

--nodeid=#,

-n #

ID of node where backup was taken

(Supported in all NDB releases based on MySQL 8.0)

--num-slices=#

Number of slices to apply when restoring by slice

ADDED: NDB 8.0.20

--parallelism=#,

-p #

Number of parallel transactions to use while restoring data

(Supported in all NDB releases based on MySQL 8.0)

--preserve-trailing-spaces,

-P

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

(Supported in all NDB releases based on MySQL 8.0)

--print

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

(Supported in all NDB releases based on MySQL 8.0)

--print-data

Print data to stdout

(Supported in all NDB releases based on MySQL 8.0)

--print-defaults

Print program argument list and exit

(Supported in all NDB releases based on MySQL 8.0)

--print-log

Print log to stdout

(Supported in all NDB releases based on MySQL 8.0)

--print-meta

Print metadata to stdout

(Supported in all NDB releases based on MySQL 8.0)

--print-sql-log

Write SQL log to stdout

(Supported in all NDB releases based on MySQL 8.0)

--progress-frequency=#

Print status of restore each given number of seconds

(Supported in all NDB releases based on MySQL 8.0)

--promote-attributes,

-A

Allow attributes to be promoted when restoring data from backup

(Supported in all NDB releases based on MySQL 8.0)

--rebuild-indexes

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

(Supported in all NDB releases based on MySQL 8.0)

--remap-column=string

Apply offset to value of specified column using indicated function and arguments. Format is [db].[tbl].[col]:[fn]:[args]; see documentation for details

ADDED: NDB 8.0.21

--restore-data,

-r

Restore table data and logs into NDB Cluster using NDB API

(Supported in all NDB releases based on MySQL 8.0)

--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 NDB releases based on MySQL 8.0)

--restore-meta,

-m

Restore metadata to NDB Cluster using NDB API

(Supported in all NDB releases based on MySQL 8.0)

--restore-privilege-tables

Restore MySQL privilege tables that were previously moved to NDB

DEPRECATED: NDB 8.0.16

--rewrite-database=string

Restore to differently named database; format is olddb,newdb

(Supported in all NDB releases based on MySQL 8.0)

--skip-broken-objects

Ignore missing blob tables in backup file

(Supported in all NDB releases based on MySQL 8.0)

--skip-table-check,

-s

Skip table structure check during restore

(Supported in all NDB releases based on MySQL 8.0)

--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 NDB releases based on MySQL 8.0)

--slice-id=#

Slice ID, when restoring by slices

ADDED: NDB 8.0.20

--tab=path,

-T path

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

(Supported in all NDB releases based on MySQL 8.0)

--timestamp-printouts{=true|false}

Prefix all info, error, and debug log messages with timestamps

ADDED: NDB 8.0.33

--usage,

-?

Display help text and exit; same as --help

(Supported in all NDB releases based on MySQL 8.0)

--verbose=#

Level of verbosity in output

(Supported in all NDB releases based on MySQL 8.0)

--version,

-V

Display version information and exit

(Supported in all NDB releases based on MySQL 8.0)

--with-apply-status

Restore the ndb_apply_status table. Requires --restore-data

ADDED: NDB 8.0.29


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.

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

In NDB 8.0.22 and later, 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.

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"

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.