ZRM是Zmanda公司出品的一套用Perl写的Mysql备份与还原工具,分商业版和社区版。
ZRM主要功能包括:
支持完整备份和增量备份;
支持逻辑备份和裸备份;
支持多种存储引擎;
支持远程备份;
备份时可选择压缩和加密;
还原操作简单;
有详细的报表信息;
可通过邮件通知你的备份结果;
可定义保留策略;
可指定计划任务定期备份;

可采用源码和rpm的方式,在安装有epel源的系统上,可直接yum install MySQL-zrm
http://www.zmanda.com/downloads/community/ZRM-MySQL/2.2/RPM/MySQL-zrm-2.2.0-1.noarch.rpm

http://www.zmanda.com/downloads/community/ZRM-MySQL/2.2/Source/MySQL-zrm-2.2.0.tar.gz

[root@monitor mysql-zrm]# cd /etc/mysql-zrm/
[root@monitor mysql-zrm]# ls
cactiback  mysql-zrm.conf  mysql-zrm-release  mysql-zrm-reporter.conf  RSS.header
说明:cactiback是备份项目名称,每个备份都需要有,是一个目录,里面还有配置文件;mysql-zrm.conf是默认配置模板

[root@monitor mysql-zrm]# cd cactiback/
[root@monitor cactiback]# ls
last_backup  mysql-zrm.conf
说明:last_backup是已经存在的备份信息

[root@monitor cactiback]# sed -n '/^#/!'p mysql-zrm.conf |sed '/^$/'d
backup-level=0
backup-mode=logical
destination=/db_back/
retention-policy=6M
compress=1
compress-plugin=/usr/bin/gzip
databases=cacti
user="root"
password="nagios"
host="localhost"
port=3306
socket=/var/lib/mysql/mysql.sock
default-character-set=utf8
verbose=1
mailto="monit@163.com"

创建备份
[root@monitor cactiback]# mysql-zrm-scheduler --now --backup-set cactiback

查看备份
[root@monitor cactiback]# mysql-zrm-reporter --show restore-info --where backup-set=cactiback

REPORT TYPE : restore-info

backup_set  backup_date                  backup_level  backup_directory                          backup_status         comment
-----------------------------------------------------------------------------------------------------------------------------------------------------
cactiback  Thu 22 Mar 2012 04:47:24                0  /db_back/cactiback/20120322164724         Backup succeeded      ----
PM CST
cactiback  Fri 09 Mar 2012 04:26:25                0  /db_back/cactiback/20120309162625         Backup succeeded      ----
PM CST
cactiback  Fri 09 Mar 2012 04:14:22                0  /db_back/cactiback/20120309161422         Backup succeeded      ----
PM CST
增加计划任务
[root@monitor cactiback]# mysql-zrm-scheduler --add --interval weekly --start-time 02:02 --day-of-week 0 --backup-level 0 --backup-set cactiback

[root@localhost ~]#  crontab -l
2 2 * * 0 /usr/bin/zrm-pre-scheduler --action backup --backup-set cactiback --backup-level 0 --interval weekly
0 4 * * * /usr/bin/mysql-zrm --action purge

One thought on “ZRM for MySQL”

发表评论

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