Documentation Home
MySQL Cluster Manager 8.0 User Manual
Related Documentation Download this Manual
PDF (US Ltr) - 1.3Mb
PDF (A4) - 1.3Mb


5.7.5 The restore cluster Command

restore cluster
    {--backupid=|-I }backup_id
    [--disable-indexes|-x]
    [--disable-metadata|-M]
    [--epoch|-e]
    [--exclude-databases=db_name]
    [--exclude-intermediate-sql-tables]
    [--exclude-missing-columns]
    [--exclude-missing-tables]
    [--exclude-tables=db_name.tbl_name[,db_name.tbl_name][,...]]
    [--include-databases=db_name]
    [--include-stored-grants]
    [--include-tables=db_name.tbl_name[,db_name.tbl_name][,...]]
    [--lossy-conversions]
    [--no-binlog|-l]
    [--no-restore-disk-objects]
    [{--parallelism=|-p }#]
    [--privilege-tables|-P]
    [--progress-frequency]
    [--promote-attributes]
    [--rewrite-database]
    [--skip-broken-objects]
    [{--skip-nodeid=|-s }id_list]
    [--skip-table-check]
    [--skip-unknown-objects]
    [--password-file=filepath]
    cluster_name

This command restores a cluster from a backup having the specified backup ID (--backupid option; short form: -I) to the MySQL NDB Cluster named cluster_name. In its simplest form, it can be used as shown here, to restore the cluster named mycluster to the state saved in the backup having backup ID 3:

mcm> restore cluster --backupid=3 mycluster;
+--------------------------------+
| Command result                 |
+--------------------------------+
| Restore completed successfully |
+--------------------------------+
1 row in set (18.60 sec)

If you are restoring an existing cluster to a known good state, you must wipe any existing data first. Stop the cluster using stop cluster, then restart it using start cluster with the --initial option, which causes the data node file systems to be cleared. (Note that for MySQL NDB Cluster 7.5, Disk Data files must be removed manually.) Following this, you can restore the cluster from the desired backup using restore cluster.

Important

In order to restore a backup using restore cluster, the cluster must have an unused slot for an ndbapi process in its configuration. Otherwise, the command fails with the error Unable to perform restore - no vacant ndbapi slots in config for cluster cluster_name. See Adding Free Processes, for information on how to add a free ndbapi slot to your cluster.

Additional options that can be employed with this command include:

--disable-indexes and --disable-metadata To cause indexes to be ignored when restoring the table data, use the --disable-indexes option. Doing this can decrease the time required to restore a large data set, particularly where many indexes were in use. Similarly, you can cause metadata to be ignored during the restoration process by using the --disable-metadata option (short form: -M).

--epoch When the --epoch option (short form: -e) is used, epoch information is restored to the cluster replication status table (mysql.ndb_apply_status), which can be useful for replicas in MySQL NDB Cluster replication.

--exclude-databases and --exclude-tables Prevent one or more databases or tables from being restored using the options --exclude-databases and --exclude-tables. --exclude-databases takes a comma-delimited list of one or more databases that should not be restored. --exclude-tables takes a comma-delimited list of one or more tables (using the database.table format) that should not be restored. When --exclude-databases or --exclude-tables is used, only those databases or tables named by the option are excluded; all other databases and tables are restored.

--exclude-missing-columns When this option is used, restore cluster ignores any columns missing from tables being restored as compared to the versions of those tables found in the backup.

--exclude-missing-tables When this option is used, restore cluster ignores any tables from the backup that are not found in the target database.

--exclude-intermediate-sql-tables[=TRUE|FALSE] When performing ALTER TABLE operations, mysqld creates intermediate tables (whose names are prefixed with #sql-). When TRUE, the --exclude-intermediate-sql-tables option keeps restore cluster from restoring such tables that may have been left over from such operations. This option is TRUE by default.

--include-databases and --include-tables Use the --include-databases option or the --include-tables option for restoring only specific databases or tables, respectively. --include-databases takes a comma-delimited list of databases to be restored. --include-tables takes a comma-delimited list of tables (in the database.table format) to be restored. When --include-databases or --include-tables is used, only those databases or tables named by the option are restored; all other databases and tables are excluded by restore cluster, and are not restored.

--include-stored-grants When managing NDB Cluster 8.0.19 and later, the restore cluster command does not restore shared users and grants to the mysql.ndb_sql_metadata table by default; use the --include-stored-grants option to override this behavior and enable the restore of shared user and grant data and metadata.

--lossy-conversions Using --lossy-conversions allows 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 Replication of Columns Having Different Data Types, for information about specific type conversions currently supported by attribute demotion. restore cluster reports any truncation of data that it performs during lossy conversions once per attribute and column.

--no-binlog The --no-binlog option (short form: -l) stops any SQL nodes (mysqld processes) in the cluster from writing data from the restore into their binary logs.

--no-restore-disk-objects This option stops restore cluster from restoring any MySQL NDB Cluster Disk Data objects, such as tablespaces and log file groups; see NDB Cluster Disk Data Tables, for more information about these objects.

--parallelism=# The --parallelism option (short form: -p) sets the maximum number of parallel transactions that the restore cluster command attempts to use. The default value is 128; the maximum is 1024, and the minimum is 1.

--privilege-tables The --privilege-tables option (short form: -P) causes restoration of tables required for distributed grants (see Distributed Privileges Using Shared Grant Tables).

--progress-frequency=N Print a status report each N seconds to a temporary stdout dump file mcm creates at mcm_data/clusters/cluster_name/nodeid/tmp while the backup is in progress. 0 (the default) causes no status reports to be printed. The maximum is 65535.

--promote-attributes Allow attributes to be promoted when MySQL Cluster Manager restores data from a backup. See the discussion on attribute promotion in the MySQL NDB Cluster manual for more details.

--rewrite-database=old_dbname,new_dbname This option causes a database with the name old_dbname in the backup to be restored under the name new_dbname.

--skip-nodeid The --skip-nodeid option (short form: -s) takes a comma-separated list of node IDs. The nodes whose IDs are listed may include of data nodes, SQL nodes, or both. Nodes having these IDs are skipped by the restoration process.

--skip-broken-objects This option causes restore cluster to ignore corrupt tables while reading a backup, and to continue restoring any remaining tables (that are not also corrupted). Currently, the --skip-broken-objects option works only in the case of missing blob parts tables.

--skip-table-check It is possible to restore data without restoring table metadata. The default behavior when doing this is for restore cluster to fail with an error if table data do not match the table schema; this can be overridden using the --skip-table-check option.

--skip-unknown-objects This option causes restore cluster to ignore any schema objects it does not recognize while reading a backup. This can be used for restoring, for example, a backup made from a newer version of MySQL NDB Cluster to an older version.

For release 8.0.28 and later: MySQL Cluster Manager supports the restoring of NDB native encrypted cluster backups. To restore an encrypted backup, use the --password-file option to provide a file that contains the encryption password for the backup. The following must be true for the password file:

  • The file must be present on each host where mcmd runs a data node that is being restored.

  • If the file path is relative, it is relative to the working directory of the mcmd agent mentioned in the last bullet.