Mysql-zrm-restore

From wiki.zmanda.com
Jump to navigation Jump to search

NAME

mysql-zrm-restore - Recovery utility for ZRM for MySQL.

SYNOPSIS

mysql-zrm-restore
                      [--backup-set name]
                      [--source-directory directory name]
                      [--bin-logs "/fullpath/name1 /fullpath/name2 ..."]
                      [--mysql-shutdown | --no-mysql-shutdown]
                      [--retry-count count]
                      [--retry-delay seconds]
                      [--replication|--noreplication]
                      [--all-databases]
                      [--databases "name1 name2 ..."]
                      [--start-position #]
                      [--stop-position #]
                      [--offset #]
                      [--start-datetime name]
                      [--stop-datetime name]
                      [--copy-plugin plugin]
                      [--ssh-user user]
                      [--socket-remote-port port]
                      [--passfile filename]
                      [--user user]
                      [--password password]
                      [--host hostname]
                      [--port portnumber]
                      [--socket name]
                      [--ssl-options "MySQL ssl options"]
                      [--mysql-binpath location of MySQL commands]
                      [--tmpdir temp_directory]
                      [--options-file filename]
                      [--quiet|--no-quiet]
                      [--verbose]
                      [--help]

DESCRIPTION

Recovery of various MySQL databases can be done using the mysql-zrm-restore utility. Use it to fully/selectively restore the database on the same system or another system.

When restoring backed up databases, use either --all-databases or --databases options.

When the backup contains only specific tables from a database, you need to specify mysql-zrm action as restore and the database name to restore the backed up tables. Tables not included in the backup but present in the database will be left untouched.

OPTIONS

--backup-set name
Specify backup-set for the backup run. This is a Command line option only and cannot be specified in the configuration file. The default value is BackupSet1. If such a value is already present, it will be used.
--source-directory directory name
Choose the directory containing a backup. This option is ignored when backup action is specified. For restore action, both source-directory and bin-logs options should not be specified. If both are present, the utility will return an error.
--bin-logs "fullpathname1 fullpathname2 ..."
List binary log files, along with their full paths to be used for restore. For restore action, both source-directory and bin-logs options should not be specified. The utility will throw an error if both are specified
--mysql-shutdown | --no-mysql-shutdown
This specifies whether the mysql server should be shutdown during the restore. If not specified, then the mysql server is shut down only if restoring from a full raw backup. If the options are not specified and the restore only contains logical full backup data or incremental backup data, the mysql server is not shut down. When restoring from a full raw backup it is recommended not to use the --no-mysql-shutdown option as it can result in unexpected problems.
--retry-count count
This specifies the number of times ZRM should try to attempt the restore of a raw backup in case the specified copy-plugin returns an error. This retry is specifically to ensure that we do not fail the full restore in case the shutdown of the mysql server takes more time than expected. Hence ZRM will only attempt to retry for the restore of the very first file that is attempted to be restored. The default value is 2.
--retry-delay delay in seconds
This specifies the time in seconds between 2 retrys. The default value is 5 seconds
--all-databases
Opt for all databases to be backed up or restored. This is the default if database or databases are not specified.
--databases "name1 name2 ..."
List the databases to backup or restore.
--replication | --noreplication
Choose replication to restore replication files. They will be restored only if the host is a replication slave. Default option is --noreplication.
--start-position N
Fix the start position N for selective restore of all events after log position N. Log position can be determined using parse-binlogs action.
--stop-position N
Stop selective restore of all events before log position N. Log positions can be determined using parse-binlogs action.
--offset N
Skip the first N entries of the first binary log file in bin-logs parameter.
--start-datetime datetime
Start selective restore from date and time specified in MySQL DATETIME or TIMESTAMP format(hh:mm:ss). The utility will throw an error if the parameter is not in the format.
--stop-datetime datetime
Selective restore till specified date and time specified in MySQL DATETIME or TIMESTAMP format(hh:mm:ss). The utility will return an error if the parameter is not in the format.
--copy-plugin plugin
Specify plugin along with full pathname to be used for transferring backup files to and from a remote MySQL server to the machine running ZRM for MySQL. Use this option when
1. remote incremental backup is required
2. copying replication related files from a remote machine
3. execute mysqlhotcopy (MySQL command) and copy the data from the remote machine
4. restore data to a remote machine using mysqlhotcopy(MySQL command). This parameter is optional.
--ssh-user user
Specifies the user to be used for SSH. This parameter is only used by the ssh-copy.pl plugin. The user specified should either be the user mysqld runs as or root. If not specified the default value used is mysql. This parameter is optional.
--socket-remote-port port
Port that the socket-plugin.pl should use to connect. This parameter is only used by the socket-copy.pl plugin. The default value used is 25300. This parameter is optional
--passfile file
The file containing the passphrase for encryption. This parameter is used only by the encrypt-plugin.pl. If not specified the value used is /etc/mysql-zrm/.passphrase. This parameter is optional.
--user user
Specify MySQL backup/restore user
--password password
Specify password for the MySQL user
--host hostname
Specify MySQL server host name or IP name.
--port portnumber
Specify MySQL server port.
--socket name
Specify socket file to use for communication with MySQL server.
--ssl-options "MySQL ssl options"
Set any --ssl* options that MySQL supports. Refer to MySQL Documentation for SSL options details.
--mysql-binpath mysql_binaries_dir
Set the full path where MySQL binaries are installed. For example: /opt/lampp/bin
--options-file filename
Set the file along with full pathname that contains MySQL command options.
--tmpdir temp_directory
Full path of the directory for storing temporary files and directories on the backup host. The default is to use the system-specified temporary directory on the backup host, e.g /tmp.
--quiet|--no-quiet
Choose quiet to suppress display of log messages on stdout. Choose no-quiet to display the log messages to standard output (stdout). The default is --no-quiet.
--verbose
Provide more detailed output in the log. Verbose output is turned off by default.
--help
Displays the help message and exits. This command line only parameter cannot be specified in the configuration file.

EXAMPLES

  • For restoring backup image dated 18 Aug 2006 (backup image can be either full or incremental backup):
mysql-zrm  --action restore --source-directory /var/lib/mysql-zrm/backupset1/20060818121532
  • The above command will restore all databases (full or incremental as the case may be) that were backed up.
mysql-zrm  --action restore --source-directory /var/lib/mysql-zrm/backupset1/20060818121532 --databases db1 db2 db3
  • The above command does a selective restore of the specified databases.
mysql-zrm    --action   restore   --bin-logs   /var/lib/mysql-zrm/backupset1/20060818121532/mysql-bin.[0-9]* /var/lib/mysql-zrm/backupset1/20060819121532/mysql-bin.[0-9]*
  • The above command does a selective restore of all specified binary log files using a single MySQL server connection.

FILES

/var/lib/mysql-zrm
Directory under which all backup data is stored.
/etc/mysql-zrm/backup set name/mysql-zrm.conf
Configuration file read by mysql-zrm utility.

RETURN VALUES

On success, zero is returned. On error, non-zero value is returned.

SEE ALSO

mysql-zrm(1), mysql-zrm-backup(1), mysql-zrm-manage-backup(1), mysql-zrm-restore(1), mysql-zrm-check(1), mysql-zrm-getconf(1), mysql-zrm-list(1), mysql-zrm-parse-binlogs(1), mysql-zrm-purge(1), mysql-zrm-extract-backup(1), mysql-zrm-verify-backup(1), mysql-zrm-scheduler(1), mysql-zrm-reporter(1), mysql-zrm.conf(5), mysqldump(1), mysqlbinlog(1), mysql(1), lvm(8).

AUTHOR

Zmanda Inc. (http:/www.zmanda.com/)