Zmanda Recovery Manager for MySQL Man pages

    mysql-zrm - Backup and recovery utility for ZRM for MySQL
    mysql-zrm-reporter - MySQL backup reporting utility
    mysql-zrm-scheduler - backup scheduler utility for ZRM for MySQL
    mysql-zrm.conf - Configuration file for ZRM for MySQL
    mysql-zrm-reporter.conf - Configuration file for ZRM reporter for MySQL
    mysql-zrm-abort-backup - Utility to abort a backup in ZRM for MySQL
    mysql-zrm-backup - Backup utility for ZRM for MySQL
    mysql-zrm-check - Utility to check the given backup set configuration
    mysql-zrm-extract-backup - Utility to extract a compressed and/or encrypted backup in ZRM for MySQL
    mysql-zrm-getconf - Utility to get the options set in the mysql-zrm.conf file.
    mysql-zrm-list - Utility to list backups performed by ZRM for MySQL
    mysql-zrm-manage-backup - Utility to manage on-line (quick) snapshot backups.
    mysql-zrm-parse-binlogs - Utility to parse MySQL binary logs for ZRM for MySQL
    mysql-zrm-purge - Utility to purge backups that have gone past retention policy date in ZRM for MySQL.
    mysql-zrm-restore - Recovery utility for ZRM for MySQL
    mysql-zrm-verify-backup - Utility to verify backup in ZRM for MySQL 

1、MySQL数据库备份

To do a backup of all databases now, use the mysql-zrm-scheduler tool.

# mysql-zrm-scheduler --now --backup-set dailyrun --backup-level 0

A backup set dailyrun is created and backups are done to the /var/lib/mysql-zrm directory.

2、定时任务
To schedule weekly full backups on Sunday at 2am:

# mysql-zrm-scheduler --interval weekly --backup-set dailyrun --start 02:00

3、报告
For more information on backup scheduling, see MySQL ZRM backup section.
Backup reports

The mysql-zrm-reporter tool can obtain the status of a backup run as well as produce various reports on the backup runs.

  #  mysql-zrm-reporter --where backup-set=dailyrun --show backup-status-info
  backup_set  backup_date                             backup_level  backup_status         comment
  ----------------------------------------------------------------------------------------------------
  dailyrun    Sun 10 Sep 2006 02:15:23 AM PDT         0             Backup succeeded      ----
  dailyrun    Sun 17 Sep 2006 02:16:43 AM PDT         0             Backup succeeded      ----

For more information on MySQL ZRM backup reporting, please see Backup reports section.
MySQL database restoration

Restoration of backups requires two steps:

    Identify the backup image to be restored. Run a backup report (restore-full-info) to find out all backup images that are available: 

#  /usr/bin/mysql-zrm-reporter -show restore-info --where backup-set=dailyrun
    backup_set  backup_date             backup_level  backup_directory
   -------------------------------------------------------------------------------------------
    dailyrun    Sun 10 Sep 2006                      0  /var/lib/mysql-zrm/dailyrun/
                02:15:23 AM PDT                         20060910021523
    dailyrun    Sun 17 Aug 2006                      0  /var/lib/mysql-zrm/dailyrun/
                02:16:43 AM PDT                         20060917021643

5、恢复备份    
Use the mysql-zrm tool to restore the database from a full backup image. 

# mysql-zrm --action restore --backup-set dailyrun \
 --source-directory /var/lib/mysql-zrm/dailyrun/20060917021643
MySQL server has been shutdown. Please restart after verification.


6、赋权限
    mysql>  grant select, insert, update, create, drop, reload, shutdown, alter, super, lock tables, replication client on *.* to 'backup-user'@'localhost' identified by '';

    mysql> show grants for 'backup-user'@'localhost';
    Grants for backup-user@localhost
    | GRANT SELECT, INSERT, UPDATE, CREATE, DROP, RELOAD, SHUTDOWN, ALTER, SUPER, LOCK TABLES, REPLICATION CLIENT ON *.* TO 'backup-user'@'localhost' IDENTIFIED BY PASSWORD '591051bb593d2f5b' WITH GRANT OPTION |

7、检查配置文件
Checking Backup Configuration

he action check of mysql-zrm command is used to verify that ZRM for MySQL is correctly configured for the backup set.

It performs following checks for a particular backup set:

    It is able to read and write to the destination directory.
    Whether the TMPDIR is writable.
    If /etc/mysql-zrm/<backup-set name> is writable.
    Whether mysql-zrm is able to connect to MySQL server. 

mysql-zrm  --action check

    Specify the backup set you to whose configuration you want to check. The command will be 

mysql-zrm --action check --backup-set Backupset1

    The action returns the following when the configuration is correct. 

INFO: ZRM for MySQL - version built from source
WARNING: Binary logging is off. Incremental backups cannot be done.
INFO: Configuration check successful

    If the configuration is incorrect it will exit with a set of error messages that reflect the problems found. The following is an example of the returned error 

INFO: ZRM for MySQL - version built from source
ERROR: Unable to open logfile /var/log/mysql-zrm/mysql-zrm.log.
ERROR: No write permission in /var/lib/mysql-zrm
ERROR: No write permission in /etc/mysql-zrm/BackupSet1
ERROR: No write permissions on /etc/mysql-zrm/BackupSet1/last_backup
ERROR: Errors found during configuration check


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

 mysql-zrm-reporter  [--fields  name1, name2, name3, name4, name5 ....]
                      [--destination dir ]
                      [--where  fieldname=value]
                      [--type  html]
                      [--output filename]
                      [--latest ]
                      [--noheader ]
                      [--show  backup-method-info |
                               backup-status-info |
                               backup-retention-info |
                               backup-performance-info |
                               restore-full-info |
                               restore-incr-info |
                               replication-info |
                               backup-app-performance-info ]
                      [--help]

 EXAMPLES

    To display backup date, location of backups, and backup set name use: 

 mysql-zrm-reporter --destination /var/lib/mysql-zrm/backup   --fields backup-date,backup-directory,backup-set

    To display backup date, backup set name, and size of backup use: 

 mysql-zrm-reporter --destination /var/lib/mysql-zrm/backup   --fields backup-date,backup-set,backup-size

    To display size of backup, backup set name, and date of backup for"config1" backup set use: 

 mysql-zrm-reporter --destination /var/lib/mysql-zrm/backup       --fields      backup-date, backup-set, backup-size --where backup-set=config1

    To display backup status report for "config1" backup set use: 

 mysql-zrm-reporter  --destination /var/lib/mysql-zrm/backup   --show backup-status-info --where backup-set=config1

    To display backup status report for "config1" backup set in HTML format and write a file use: 

 mysql-zrm-reporter --destination /var/lib/mysql-zrm/backup --show backup-status-info     --where backup-set=config1 --type html --output myreport.html


 
 mysql-zrm-scheduler --add|--query|--delete|--now
                    [--start-time start time]
                    [--day-of-week day of week]
                    [--day-of-month day of month]
                    [--interval interval]
                    [--backup-level level]
                    [--backup-set backupset name]
                    [--help]

 EXAMPLES

    To schedule a daily mysql-zrm run that starts at 1:35pm: 

$ mysql-zrm-scheduler --add -interval daily --start 02:02 --backup-set behe_ministite

    To schedule a weekly mysql-zrm run on Tuesday and Wednesday: 

$ mysql-zrm-scheduler --add -interval weekly --day-of-week 2-3

    To schedule a monthly mysql-zrm run on the tenth day of each month: 

$ mysql-zrm-scheduler    --add    --interval  monthly --day-of-month  10

    To query scheduled runs: 

$ mysql-zrm-scheduler --query
35  13  *  *  * /usr/bin/zrm-pre-scheduler --action backup --backup-set BackupSet1 --interval daily
0  2 * * 2-3  /usr/bin/zrm-pre-scheduler  --action  backup --backup-set BackupSet1  --interval weekly
0  0  10  *  *  /usr/bin/zrm-pre-scheduler --action backup --backup-set BackupSet1 --interval monthly

    To delete a daily mysql-zrm run with specific start time: 

$  mysql-zrm-scheduler  --delete  --interval daily --start 08:20


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

发表评论

电子邮件地址不会被公开。 必填项已用*标注