Mysql-zrm: Difference between revisions

From wiki.zmanda.com
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
== NAME ==
==NAME==


mysql-zrm - Backup and recovery utility for "ZRM for MySQL"
mysql-zrm - Backup and recovery utility for ZRM for MySQL


==SYNOPSIS==
==SYNOPSIS==
        
       mysql-zrm --action [ backup |
mysql-zrm  
                            restore |
        --action <backup|restore|list|purge|parse-binlogs|check|verify-backup|extract-backup|abort-backup>
                            schedule-backup |
          [--backup-set <name>]
                            report |
          [--source-directory <directory name>]
                            list |
          [--replication | --noreplication]
                            purge  |
          [--backup-name <name>]
                            parse-binlogs  |
          [--all-databases]
                            check  |
          [--databases <"name1 name2 ...">]
                            verify-backup |
          [--destination <directory name>]
                            extract-backup  |
          [--database <name> [--tables <"name1 name2...">]]
                            abort-backup ]
          [--backup-level <0|1>]
          [--backup-mode <raw|logical>]
          [--lvm-snapshot <size>]
          [--retention-policy  <backup retention time>]
          [--compress | --no-compress ]
          [--compress-plugin <plugin>]
          [--no-encrypt | --encrypt]
          [--encrypt-plugin <plugin> [--decrypt-option <option>]
          [--passfile <filename> ]
          [--routines | --no-routines ]
          [--default-character-set <char set name> ]
          [--bin-logs <"/fullpath/name1 /fullpath/name2 ...">]
          [--mysql-shutdown | --no-mysql-shutdown]
          [--start-position <#>]
          [--stop-position <#>]
          [--offset <#>]
          [--start-datetime <name>]
          [--stop-datetime <name>]
          [--index|--noindex]
          [--till-lastfull]
          [--all-backups]
          [--copy-plugin <plugin>]
          [--ssh-user <user>]
          [--remote-mysql-binpath <path>]
          [--socket-remote-port <port>]
          [--pre-backup-plugin <plugin>]
          [--pre-backup-plugin-options <"option1 option2 ...">]
          [--post-backup-plugin <plugin>]
          [--post-backup-plugin-options <"option1 option2 ...">]
          [--parse-binlogs-plugin <plugin>]
          [--parse-binlogs-plugin-options <"option1 option2 ...">]
          [--options-file <filename>]
          [--mailto <mail address>]
          [--user <user>]
          [--password <password>]
          [--host <hostname>]
          [--port <portnumber>]
          [--socket <name>]
          [--mysql-binpath <location  of MySQL commands>]
          [--mysql-binlog-path <location of MySQL binary logs>]
          [--tmpdir <temporary directory to be used>
          [--ssl-options <"MySQL ssl options">]
          [--comment <"Note about the backup">]
          [--quiet|--no-quiet]
          [--verbose]
          [--help]


==DESCRIPTION==
==DESCRIPTION==


ZRM for MySQL is designed to schedule and create backups of live MySQL databases in a convenient and automated manner. Configure it only once to reflect the MySQL deployment. Schedule it to run unattended. It has intelligent options to help an administrator to verify the backups created. Generate various types of reports about the backup created. The backups can be compressed and encrypted as desired. Get information about the backups via an email or RSS feed. Write  pre and post plugins to extend the suite further. Use it to fully/selectively restore the database on the same system or another system.
ZRM for MySQL provides  automated  scheduling  of live MySQL database backup. You only need to configure it once to reflect the MySQL deployment,  then  schedule it to run unattended backups. Various options can help an administrator:


Its main utility is ''mysql-zrm''. It does the core function of backup and recovery of various MySQL databases.
* Verify the backups created.
* Generate various types of reports about the backups created.
* Specify compression and encryption as desired.
* Report information about the backups via an email or RSS feed.
* Access pre- and post- backup plugins to extend the suite further.
* Control full and selective  restore  operations  on  the database, both locally and remotely.


Use [[mysql-zrm.conf]](5) the configuration file to configure ''mysql-zrm''.  The action ''check'' can be used to verify the configuration of ''mysql-zrm''.
ZRM  for  MySQL ’s  primary  command  line  utility  is mysql-zrm, which provides the core backup/restore functions for MySQL databases.


Use ''mysql-zrm'' to create full or incremental backups of MySQL databases and do full, incremental and selective restore of them. The ''list'' option provides information about the prior backups.
Use   the  [[mysql-zrm.conf]](5)  configuration  file  to set mysql-zrm  options.


Use it to implement retention policy for the backup images. The action ''verify-backup'' verifies consistency of backup images.
Use the --action check option to verify the  configuration of mysql-zrm.


Parse binary logs to find out the timestamp and/or log position of specific database events.
Use  mysql-zrm  to create  full or incremental backups of MySQL  databases and  perform  full,  incremental  and  selective  restores as well. The --list option provides information about prior backups.


Please take a look at [[Zmanda_Recovery_Manager_for_MySQL|ZRM  for  MySQL  documentation]] for procedures on how to configure and use ZRM for MySQL.
To display help on individual action options, append the --help option to the appropriate command line. For  example:
  mysql-zrm --action backup --help


===BACKUP SETS===
===BACKUP SETS===


ZRM for MySQL organizes the backups in terms of backup sets. Each backup set defines the list of databases or tables within a database, how it should be backed up and the backup schedule for the data. Backup sets are identified by a unique name string.
ZRM for MySQL organizes the backups into ''backup sets''. Each backup set defines:


Every backup run (each time ''mysql-zrm'' is executed) is associated with one backup set. Various parameters can be associated with each backup run.
* a list of database(s) or table(s) within a database to back up
* backup options to use on this backup set
* scheduling options to use on this backup set.


''mysql-zrm'' first reads the global configuration file (''/etc/mysql-zrm/mysql-zrm.conf''). The global configuration file can be overridden by backup set specific configuration file stored in ''/etc/mysql-zrm/<backup set name>/'' directory. The ''mysql-zrm'' command line options will override the parameters specified in the configuration files.  
Backup sets are identified by a unique name.


Every backup run (each time mysql-zrm is executed) is  associated  with one  backup  set.  Various  parameters can be associated with each backup run.
mysql-zrm    first    reads    the    global      configuration  file (/etc/mysql-zrm/mysql-zrm.conf).  The  global configuration file can be overridden  by  any  backup  set  configuration    file stored  in ''/etc/mysql-zrm/backup  set  name/'' directory. The mysql-zrm command line options will override the parameters  specified  in  the configuration files.
===BACKUP METHODS===
===BACKUP METHODS===


''mysql-zrm'' backups can be either full or incremental.
mysql-zrm   backups can be either full or incremental. Full backups can be logical backups or raw backups. Logical backups contain SQL statements   to recreate the database. Raw backups are actual copies of the database files.
 
Full backups can be logical backups or raw backups.
 
Logical backups contain SQL statements to recreate the database.
 
Raw backups are actual copies of the database files.
 
When logical backup is specified, the utility uses only ''mysqldump'' for backing up specified databases and tables.
 
When raw backup is specified, the utility has the ability to decide which backup mechanism to use for a particular database. If there are no transactional storage engine based tables in the specified database, then it uses ''mysqlhotcopy'' for backing up that database. Otherwise, it uses ''mysqldump'' for backing up the specified database.


When ''lvm-snapshot'' is specified and the specified database is on an LVM volume, then a snapshot of that volume is taken and the database is backed up from that snapshot. If the database is not on an lvm volume then the ''mysqlhotcopy'' or ''mysqldump'' will be used as per the logic in the last paragraph.
When logical backup is specified, the utility  uses  only mysqldump for backing up specified databases and tables.


When ''replication'' is specified and if the MySQL server is a replication slave, then it will also backup all replication related files.
When   raw  backup  is   specified,  the utility has the ability to decide which backup mechanism to use for a particular  database.  If  there  are no transactional storage engine based tables in the specified database, it uses mysqlhotcopy for backing up that database.  Otherwise, it uses mysqldump for backing up the specified database.


When ''destination'' specified then the backups are stored in a sub-directory under the specified directory. Default path is "''/var/lib/mysql-zrm''". If the destination specified does not exist, it will throw an error and exit i.e. the utility does not create the directory.
An   index file is also created in the backup directory. The index contains the details of what was backed up, how much data was backed up, what   parameters were used to backup the data, how much time it took to backup etc.
 
An index file is also created in the backup directory. The index is a file that contains the details of what was backed up, how much data was backed up, what parameters were used to backup the data, how much time it took to backup etc.
 
When incremental backup is specified, then the options ''backup-mode'', ''lvm-snapshot'', ''all-databases'', ''databases'', ''database'' and ''tables'' are ignored.  


===RECOVERY===
===RECOVERY===


When restoring backed up databases, only ''all-databases'' and ''databases'' options are supported.
When restoring databases,  only  the  all-databases and databases  options are  allowed.   In   the  case of  clusters,  only  the all-databases option is allowed.
 
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.
 
===OTHER ACTIONS===
 
Use ''list'' action to display the backup level, the name of the directory containing the backup and the index of the last backup of the specified backup set.
 
Opt for ''all-backups'' action to display specified data for all of the backups that have happened till date for the given backup-set.
 
Specify ''till-lastfull'' action to display the data since last full backup.
 
Use ''source-directory'' action to display the index of that backup.
 
Action ''noindex'' will display only the level of backup and the name of the directory containing the backup. The contents of the index file will not be displayed.
 
Action ''parse-binlogs'' will display the parsed output of the binary logs. This is useful to find out the log positions and/or timestamp to be used for restore operations. Either the ''source-directory'' or the ''bin-logs'' option should be specified. When the ''source-directory'' option is specified then the parsed output of the binary logs from that backup will be displayed. When ''bin-logs'' option is specified then parsed output of the binary log file specified will be displayed.
 
Specify ''purge'' action to remove backups present in the directory specified by the destination option whose retention policy has been exceeded.
 
Opt for ''verify-backup'' action to check if the backed up data is consistent. The directory containing the backup needs to be specified using the source-directory option.
 
Specify ''abort-backup'' action to abort the backup run for a given backup set.
 
==OPTIONS==
 
; --action <backup|restore|list|purge|parse-binlogs|check|verify-backup|abort-backup> : This command line option(s) chooses the basic functionality of the utility. It cannot be specified in the configuration file.
 
; --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 throw an error.
 
; --replication | --noreplication : Choose replication to backup replication files. They will be backed up only if the host is a replication slave. Default option is ''--noreplication''.
 
; --backup-name <name> : Specify the directory path and a unique name to store the backup. If name is not specified or it already exists, the current timestamp will be used as the backup name.
 
; --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.
 
; --database <name> [--tables <"name1 name2 ...">] : List the tables that should be backed up. This option is valid during the backup operation only.
 
; --destination <directory name> : Specify the directory where backup should be stored. Default location is ''/var/lib/mysql-zrm/''. If this option is specified, the directory must be exist and should be writable by the ZRM for MySQL user. Else the utility will exit with an error.
 
; --backup-level <0|1> : Choose 0 for full backup. Choose 1 for incremental back up. Default is full backup.
 
; --backup-mode <raw|logical> : Database/tables that use a transactional engine cannot be backed up by ''mysqldump''. They should be backed up by ''mysqlhotcopy''. Choose ''raw'' to use ''mysqlhotcopy'' to backup the database/tables that use a transactional engine. Choose ''logical'' to use ''mysqldump'' to backup the database/tables that don't use a transactional engine.
: Default value is ''raw''.
 
; --lvm-snapshot <size> : Set the size of the lvm snapshot to be generated. For ''raw'' backups, each specified database is first checked ensure that it is on a LVM volume and then a snapshot of the specified size is created and used to backup the database. If the specified database is not on a LVM volume, either ''mysqlhotcopy'' or ''mysqldump'' will be used to create the backup based on the logic described in the ''backup-mode'' option. This option is ignored if the ''backup-mode'' is ''logical''.
 
; --retention-policy <backup retention time> : Fix the retention time of the Backup image. Suffix 'D' specifies time in days. Suffix 'W' specifies in weeks (number of days are computed as 7*amount). Suffix 'M' specifies in months (number of days are computed as 30*amount). Suffix 'Y' specifies in Years (number of days are computed as 365*amount).
 
: For example: if ''--retention-policy 10M'' is specified, it indicates that the backup should be retained for 300 days. No suffix means that the amount specified in days. The default value is to retain backups forever.
 
; --compress|--no-compress : Choose whether the backup images are to be compressed or not. Default compression command used is ''gzip''. Default is no compression.
 
; --compress-plugin <plugin> : Specify <plugin> along with its full path, to be used for compression (plugin must accept ''-d'' option to uncompress data). This parameter is optional and default is ''gzip''.
 
; --no-encrypt| --encrypt : Choose if the backup should be encrypted. This parameter is optional and the default is no encryption. Encryption keys are not managed by ZRM for MySQL.
 
; --encrypt-plugin <plugin> [--decrypt-option <option>] : Specify <plugin> along with its full path, to be used for encrypting the backup. If ''decrypt-option'' is not specified then ''-d'' option of encrypt-plugin is used for decrypting. 
 
; --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.
 
; --routines|--no-routines : If --routines  is  specified  then mysqldump will dump stored routines. The default is --no-routines. This parameter is optional.
 
; --default-character-set <char set name> : The default character set that   mysqldump should use. If not specified ''utf8'' is used. This parameter is optional.
 
; --bin-logs <"/fullpath/name1 /fullpath/name2 ...> : 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 if the mysql server should be shutdown during the restore process or not. If the options is not specified at all then the mysql server is only shutdown 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 will not be shutdown. 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.
 
; --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. The utility will throw an error if they are not in these formats.
     
; --stop-datetime <datetime> : Selective restore till specified date and time specified in MySQL DATETIME or TIMESTAMP format. The utility will throw an error if they are not in these formats.
 
; --index|--noindex : Choose index to display of contents during the ''list'' action. Choose ''noindex'' to suppress the display of contents. Default value is ''index''.
 
; --all-backups : Specify display of information of all available backups.
 
; --till-lastfull : Specify display of information of all backups done after last full backup.
 
; --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.
 
; --remote-mysql-binpath <path> : Full path where mysql binaries are installed  on the  remote machine. For  example: '' /opt/lampp/bin''.  This  parameter is only used by the ''socket-copy.pl'' and ''ssh-copy.pl'' plugins. If not specified, the default value used is ''/usr/bin''.
 
; --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.  If  not specified  the  default  value  used is ''25300''. This parameter is optional.
 
; --pre-backup-plugin <plugin> : Specify plugin along with full pathname to be called before a backup run. This parameter is optional.
 
; --pre-backup-plugin-options <"option1 option2 ..."> : Pass options to the ''pre-backup-plugin'' as one of the command line arguments.
 
; --post-backup-plugin <plugin> : Set the plugin along with full pathname to be called after a backup run. This plugin is optional.
 
; --post-backup-plugin-options <"option1 option2 ..."> : Pass options to the ''post-backup-plugin'' as one of the command line arguments.
 
; --parse-binlogs-plugin <plugin> : Set the plugin along with full pathname that filters the output of ''parse-binlogs'' action. This plugin is optional.
 
; --parse-binlogs-plugin-options <"option1 option2 ..."> : Pass options to the ''parse-binlogs-plugin'' as one of the command line arguments.
 
; --options-file <filename> : Set the file along with full pathname that contains MySQL command options.
 
; --mailto <mail address> : Set the address to which backup report will be sent.
 
; --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.
 
; --mysql-binpath <mysql binaries directory> : Set the full path where mysql binaries are installed. For example: ''/opt/lampp/bin''
 
; --mysql-binlog-path <location of mysql binary logs> : Set the  full path of the location of mysql binary logs. For example: ''/var/log/mysql'' 
 
; --tmpdir <temporary directory to be used> : Full path of the directory to  be  used  for  storing temporary files  and  directories on the backup host as  well as the remote hosts.  This directory should have sufficient space to hold at least  one  full backup on the MySQL server during backup and on the backup host during restore. If not specified it defaults to the system specified  temporary  directory on the ZRM for MySQL host, example: ''/tmp''.
 
; --ssl-options <"MySQL ssl options"> : Set any --ssl* options that MySQL supports. Refer to MySQL Documentation for SSL options details.
 
; --comment <"Note about the backup run"> : Insert a comment or a note about the backup run. This can be used to tag backup runs and the note can retrieved using [[mysql-zrm-reporter]](1) utility.


; --quiet|--no-quiet : Choose quiet to suppress display of log messages on stdout. Choose ''no-quiet'' to display the log messages stdout. Default is ''--no-quiet''.
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.


; --verbose : Provide verbose output in the log. Default is that verbose is turned off and a terse output is generated.
===ACTIONS===


; --help : Displays the help message and exits. This command line only parameter cannot be specified in the configuration file.
Specify backup to initiate a backup run.


==EXAMPLES==
Use restore to restore from a specified backup.


''mysql-zrm'' is used for database restoration, verification of backup images and parsing incremental backups.
Use  schedule-backup to setup the schedule for the backup.


For restoring backup image dated 18 Aug 2006 (backup image can be either full or incremental backup):
Specify report to generate reports on backup runs.


  mysql-zrm --action restore --source-directory /var/lib/mysql-zrm/backupset1/20060818121532
Use check to verify if a backup set configuration is correct.


The above command will restore all databases (full or incremental as the case may be) that were backed up.
Use  list  to  display the backup level, the name of the directory containing the backup and the index of the  last  backup  of the  specified backup set.


  mysql-zrm --action restore --source-directory /var/lib/mysql-zrm/backupset1/20060818121532 \
Action parse-binlogs will display the parsed output of the binary logs.  This is useful to  find  out  the  log  positions  and/or timestamp  to be used for restore operations.
          --databases "db1 db2 db3


The above command does a selective restore of the specified databases.
Specify  purge  to remove backups present in the directory specified by the destination option whose retention policy has been exceeded.


mysql-zrm  --action restore \
Specify verify-backup to verify a backup
            --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.
Use extract-backup to uncompress/decrypt a specified backup


  mysql-zrm --action parse-binlogs \
Specify abort-backup to abort the backup run for a  given backup-set.
            --bin-logs /var/lib/mysql-zrm/backupset1/20060818121532/mysql-bin.[0-9]* \
                        /var/lib/mysql-zrm/back-upset1/20060819121532/mysql-bin.[0-9]*


The above command parses and displays the relevant contents of all specified binary log files. Use it to find out what position and or timestamp to specify for selective restores.
===OPTIONS===


  mysql-zrm --action verify-backup --backup-set backup
--action backup | restore | schedule-backup | report | list  |
          purge  |  parse-binlogs  |  check  | verify-backup |
          extract-backup | abort-backup


The above command verifies the backup images of the last backup run for the backup set ''backup''.
These mutually exclusive  --action  options  choose the basic functionality  of   the utility.  This form cannot be used in the configuration file.


==FILES==
==FILES==
Line 293: Line 103:
; /var/lib/mysql-zrm : Directory under which all backup data is stored.
; /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.
; /etc/mysql-zrm/backup set name/mysql-zrm.conf : Configuration file ZRM for MySQL.


==RETURN VALUES==
==RETURN VALUES==


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


==SEE ALSO==
==SEE ALSO==


[[mysql-zrm-scheduler]](1), [[mysql-zrm-reporter]](1),  [[mysql-zrm.conf]](5), mysqldump(1), mysqlbinlog(1), mysql(1), lvm(8), [[Zmanda_Recovery_Manager_for_MySQL|Zmanda Recovery  Manager  for  MySQL]]
[[mysql-zrm-backup]](1), [[mysql-zrm-restore]](1),  [[mysql-zrm-check]](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-abort-backup]](1), [[mysql-zrm-scheduler]](1), [[mysql-zrm-reporter]](1),  [[mysql-zrm.conf]](5), mysqldump(1), mysqlbinlog(1), mysql(1), lvm(8)


==AUTHOR==
==AUTHOR==


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

Revision as of 22:30, 28 March 2008

NAME

mysql-zrm - Backup and recovery utility for ZRM for MySQL

SYNOPSIS

      mysql-zrm --action [ backup |
                           restore |
                           schedule-backup |
                           report |
                           list |
                           purge  |
                           parse-binlogs  |
                           check   |
                           verify-backup  |
                           extract-backup  |
                           abort-backup ]

DESCRIPTION

ZRM for MySQL provides automated scheduling of live MySQL database backup. You only need to configure it once to reflect the MySQL deployment, then schedule it to run unattended backups. Various options can help an administrator:

  • Verify the backups created.
  • Generate various types of reports about the backups created.
  • Specify compression and encryption as desired.
  • Report information about the backups via an email or RSS feed.
  • Access pre- and post- backup plugins to extend the suite further.
  • Control full and selective restore operations on the database, both locally and remotely.

ZRM for MySQL ’s primary command line utility is mysql-zrm, which provides the core backup/restore functions for MySQL databases.

Use the mysql-zrm.conf(5) configuration file to set mysql-zrm options.

Use the --action check option to verify the configuration of mysql-zrm.

Use mysql-zrm to create full or incremental backups of MySQL databases and perform full, incremental and selective restores as well. The --list option provides information about prior backups.

To display help on individual action options, append the --help option to the appropriate command line. For example:

 mysql-zrm --action backup --help

BACKUP SETS

ZRM for MySQL organizes the backups into backup sets. Each backup set defines:

  • a list of database(s) or table(s) within a database to back up
  • backup options to use on this backup set
  • scheduling options to use on this backup set.

Backup sets are identified by a unique name.

Every backup run (each time mysql-zrm is executed) is associated with one backup set. Various parameters can be associated with each backup run.

mysql-zrm first reads the global configuration file (/etc/mysql-zrm/mysql-zrm.conf). The global configuration file can be overridden by any backup set configuration file stored in /etc/mysql-zrm/backup set name/ directory. The mysql-zrm command line options will override the parameters specified in the configuration files.

BACKUP METHODS

mysql-zrm backups can be either full or incremental. Full backups can be logical backups or raw backups. Logical backups contain SQL statements to recreate the database. Raw backups are actual copies of the database files.

When logical backup is specified, the utility uses only mysqldump for backing up specified databases and tables.

When raw backup is specified, the utility has the ability to decide which backup mechanism to use for a particular database. If there are no transactional storage engine based tables in the specified database, it uses mysqlhotcopy for backing up that database. Otherwise, it uses mysqldump for backing up the specified database.

An index file is also created in the backup directory. The index contains the details of what was backed up, how much data was backed up, what parameters were used to backup the data, how much time it took to backup etc.

RECOVERY

When restoring databases, only the all-databases and databases options are allowed. In the case of clusters, only the all-databases option is allowed.

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.

ACTIONS

Specify backup to initiate a backup run.

Use restore to restore from a specified backup.

Use schedule-backup to setup the schedule for the backup.

Specify report to generate reports on backup runs.

Use check to verify if a backup set configuration is correct.

Use list to display the backup level, the name of the directory containing the backup and the index of the last backup of the specified backup set.

Action parse-binlogs will display the parsed output of the binary logs. This is useful to find out the log positions and/or timestamp to be used for restore operations.

Specify purge to remove backups present in the directory specified by the destination option whose retention policy has been exceeded.

Specify verify-backup to verify a backup

Use extract-backup to uncompress/decrypt a specified backup

Specify abort-backup to abort the backup run for a given backup-set.

OPTIONS

--action backup | restore | schedule-backup | report | list  |
         purge  |  parse-binlogs  |  check  | verify-backup |
         extract-backup | abort-backup

These mutually exclusive --action options choose the basic functionality of the utility. This form cannot be used in the configuration file.

FILES

/var/lib/mysql-zrm
Directory under which all backup data is stored.
/etc/mysql-zrm/backup set name/mysql-zrm.conf
Configuration file ZRM for MySQL.

RETURN VALUES

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

SEE ALSO

mysql-zrm-backup(1), mysql-zrm-restore(1), mysql-zrm-check(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-abort-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/)