安装ZRM:
[root@master ~]# yum -y install perl-DBI perl-DBD-MySQL perl-XML-Parser [root@master ~]# yum localinstall MySQL-zrm-3.0-1.noarch.rpm [root@master ~]# ls /etc/mysql-zrm/ mysql-zrm.conf mysql-zrm-release mysql-zrm-reporter.conf RSS.header [root@master mysql-zrm]# ln -s /usr/local/mysql/bin/* /usr/bin/
mysql> grant select, insert, update, create, drop, reload, shutdown, alter, super, lock tables, replication client on *.* to 'backup-user'@'localhost' identified by 'redhat'; Query OK, 0 rows affected (0.01 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
[root@master ~]# mkdir /backup/zrm -pv [root@master mysql-zrm]# mkdir full
[root@master full]# egrep -v '^#|^$' mysql-zrm.conf backup-level=0 backup-mode=raw lvm-snapshot=100M snapshot-plugin="/usr/share/mysql-zrm/plugins/lvm-snapshot.pl" backup-type=regular destination=/backup/zrm retention-policy=1W compress=1 compress-plugin=/usr/bin/gzip all-databases=1 user="backup-user" password="redhat" host="localhost" socket=/tmp/mysql.sock mysql-binlog-path="/mydata/data" mailto="[email protected]"
[root@master mysql-zrm]# mysql-zrm-scheduler --now --backup-set full schedule:INFO: ZRM for MySQL Community Edition - version 3.0 Logging to /var/log/mysql-zrm/mysql-zrm-scheduler.log backup:INFO: ZRM for MySQL Community Edition - version 3.0 full:backup:INFO: START OF BACKUP full:backup:INFO: PHASE START: Initialization full:backup:WARNING: The lvm-snapshot option is deprecated. Use snapshot-size instead full:backup:INFO: backup-set=full full:backup:INFO: backup-date=20130827000610 full:backup:INFO: mysql-server-os=Linux/Unix full:backup:INFO: backup-type=regular full:backup:INFO: host=localhost full:backup:INFO: backup-date-epoch=1377533170 full:backup:INFO: retention-policy=1W full:backup:INFO: mysql-zrm-version=ZRM for MySQL Community Edition - version 3.0 full:backup:INFO: mysql-version=5.5.28-log full:backup:INFO: backup-directory=/backup/zrm/full/20130827000610 full:backup:INFO: backup-level=0 full:backup:INFO: backup-mode=raw full:backup:INFO: PHASE END: Initialization full:backup:INFO: PHASE START: Running pre backup plugin full:backup:INFO: PHASE END: Running pre backup plugin full:backup:INFO: PHASE START: Flushing logs full:backup:INFO: PHASE END: Flushing logs full:backup:INFO: PHASE START: Creating snapshot based backup full:backup:INFO: File Position Binlog_Do_DB Binlog_Ignore_DB mysql-bin.000019 107 full:backup:INFO: innodb-data=/mydata/data/ibdata1; full:backup:INFO: innodb-logs=/mydata/data/./ib_logfile* full:backup:INFO: raw-databases-snapshot=test shop mysql performance_schema bbs full:backup:INFO: PHASE END: Creating snapshot based backup full:backup:INFO: PHASE START: Calculating backup size & checksums full:backup:INFO: next-binlog=mysql-bin.000019 full:backup:INFO: backup-size=35.41 MB full:backup:INFO: PHASE END: Calculating backup size & checksums full:backup:INFO: PHASE START: Compression/Encryption full:backup:INFO: compress=/usr/bin/gzip full:backup:INFO: backup-size-compressed=1.60 MB full:backup:INFO: PHASE END: Compression/Encryption full:backup:INFO: read-locks-time=00:00:02 full:backup:INFO: flush-logs-time=00:00:01 full:backup:INFO: compress-encrypt-time=00:00:20 full:backup:INFO: backup-time=00:00:15 full:backup:INFO: backup-status=Backup succeeded full:backup:INFO: Backup succeeded full:backup:INFO: PHASE START: Running post backup plugin full:backup:INFO: PHASE END: Running post backup plugin full:backup:INFO: PHASE START: Mailing backup report full:backup:INFO: PHASE END: Mailing backup report full:backup:INFO: PHASE START: Cleanup full:backup:INFO: PHASE END: Cleanup full:backup:INFO: END OF BACKUP /usr/bin/mysql-zrm started successfully
root@master ~]# df -Th Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/mydata-mydata ext4 5.0G 182M 4.5G 4% /mydata /dev/mapper/mydata-zrmQGzbaZ6jWo ext4 5.0G 182M 4.5G 4% /backup/zrm/full/20130827000610/ZRM_MOUNTS/zrmQGzbaZ6jWo [root@master mysql-zrm]# ll -h full/ total 4.0K -rw-r--r-- 1 root root 32 Aug 27 00:06 last_backup
[root@master mysql-zrm]# cat full/last_backup /backup/zrm/full/20130827000610 [root@master mysql-zrm]# ll -h /backup/zrm/full/20130827000610/ total 1.7M #启用了压缩功能的缘故 -rw-r--r-- 1 root root 1.6M Aug 27 00:06 backup-data -rw-r--r-- 1 root root 680 Aug 27 00:06 index -rw-r--r-- 1 root root 126 Aug 27 00:06 zrm_checksum
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | bbs | | mysql | | performance_schema | | shop | | test | +--------------------+ 6 rows in set (0.00 sec)
mysql> insert into shop.ecs_users(user_name,last_time) values('week0',now()); Query OK, 1 row affected, 7 warnings (0.00 sec) mysql> select user_id,user_name,last_time from shop.ecs_users; +---------+-----------+---------------------+ | user_id | user_name | last_time | +---------+-----------+---------------------+ | 1 | ecshop | 0000-00-00 00:00:00 | | 2 | vip | 0000-00-00 00:00:00 | | 3 | text | 0000-00-00 00:00:00 | | 5 | zuanshi | 0000-00-00 00:00:00 | | 6 | week0 | 2013-08-27 00:15:21 | +---------+-----------+---------------------+ 5 rows in set (0.00 sec) mysql> drop database shop; Query OK, 88 rows affected (0.13 sec)
[root@master mysql-zrm]# mysql-zrm-reporter --show restore-info --where backup-set=full REPORT TYPE : restore-info backup_set backup_date backup_level backup_directory backup_status comment ----------------------------------------------------------------------------------------------------------------------------------------------------- full Tue 27 Aug 2013 12:06:10 0 /backup/zrm/full/20130827000610 Backup succeeded ---- AM CST
[root@master mysql-zrm]# mysql-zrm --action verify-backup --backup-set full verify-backup:INFO: ZRM for MySQL Community Edition - version 3.0 full:verify-backup:INFO: Verification successful
root@master mysql-zrm]# mysql-zrm --action restore --backup-set full --source-directory /backup/zrm/full/20130827000610 restore:INFO: ZRM for MySQL Community Edition - version 3.0 dailyrun:restore:WARNING: The lvm-snapshot option is deprecated. Use snapshot-size instead dailyrun:restore:INFO: Restored innodb log '/mydata/data/ib_logfile0' dailyrun:restore:INFO: Restored innodb log '/mydata/data/ib_logfile1' dailyrun:restore:INFO: Restored innodb data file '/mydata/data/ibdata1' dailyrun:restore:INFO: Restored database from raw backup: test dailyrun:restore:INFO: Restored database from raw backup: shop dailyrun:restore:INFO: Restored database from raw backup: mysql dailyrun:restore:INFO: Restored database from raw backup: performance_schema dailyrun:restore:INFO: Restored database from raw backup: bbs dailyrun:restore:INFO: Restore done in 31 seconds. MySQL server has been shutdown. Please restart after verification. [root@master ~]# service mysqld start Starting MySQL... SUCCESS! mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | bbs | | mysql | | performance_schema | | shop | | test | +--------------------+ 6 rows in set (0.00 sec) mysql> use shop Database changed mysql> select user_id,user_name,last_time from shop.ecs_users; +---------+-----------+---------------------+ | user_id | user_name | last_time | +---------+-----------+---------------------+ | 1 | ecshop | 0000-00-00 00:00:00 | | 2 | vip | 0000-00-00 00:00:00 | | 3 | text | 0000-00-00 00:00:00 | | 5 | zuanshi | 0000-00-00 00:00:00 | +---------+-----------+---------------------+ 4 rows in set (0.00 sec) 记录中不含week0
mysql> insert into shop.ecs_users(user_name,last_time) values('week0',now()); Query OK, 1 row affected, 7 warnings (0.03 sec) mysql> select user_id,user_name,last_time from shop.ecs_users; +---------+-----------+---------------------+ | user_id | user_name | last_time | +---------+-----------+---------------------+ | 1 | ecshop | 0000-00-00 00:00:00 | | 2 | vip | 0000-00-00 00:00:00 | | 3 | text | 0000-00-00 00:00:00 | | 5 | zuanshi | 0000-00-00 00:00:00 | | 6 | week0 | 2013-08-27 01:11:39 | +---------+-----------+---------------------+ 5 rows in set (0.00 sec)
[root@master mysql-zrm]# mkdir mybak-`date +%F` [root@master mysql-zrm]# cp mysql-zrm.conf mybak-`date +%F` [root@master mysql-zrm]# mysql-zrm-scheduler --now --backup-set mybak-`date +%F` schedule:INFO: ZRM for MySQL Community Edition - version 3.0 Logging to /var/log/mysql-zrm/mysql-zrm-scheduler.log backup:INFO: ZRM for MySQL Community Edition - version 3.0 mybak-2013-08-27:backup:INFO: START OF BACKUP mybak-2013-08-27:backup:INFO: PHASE START: Initialization mybak-2013-08-27:backup:WARNING: The lvm-snapshot option is deprecated. Use snapshot-size instead mybak-2013-08-27:backup:INFO: backup-set=mybak-2013-08-27 mybak-2013-08-27:backup:INFO: backup-date=20130827012922 mybak-2013-08-27:backup:INFO: mysql-server-os=Linux/Unix mybak-2013-08-27:backup:INFO: backup-type=regular mybak-2013-08-27:backup:INFO: host=localhost mybak-2013-08-27:backup:INFO: backup-date-epoch=1377538162 mybak-2013-08-27:backup:INFO: retention-policy=1W mybak-2013-08-27:backup:INFO: mysql-zrm-version=ZRM for MySQL Community Edition - version 3.0 mybak-2013-08-27:backup:INFO: mysql-version=5.5.28-log mybak-2013-08-27:backup:INFO: backup-directory=/backup/zrm/mybak-2013-08-27/20130827012922 mybak-2013-08-27:backup:INFO: backup-level=0 mybak-2013-08-27:backup:INFO: backup-mode=raw mybak-2013-08-27:backup:INFO: PHASE END: Initialization mybak-2013-08-27:backup:INFO: PHASE START: Running pre backup plugin mybak-2013-08-27:backup:INFO: PHASE END: Running pre backup plugin mybak-2013-08-27:backup:INFO: PHASE START: Flushing logs mybak-2013-08-27:backup:INFO: PHASE END: Flushing logs mybak-2013-08-27:backup:INFO: PHASE START: Creating snapshot based backup mybak-2013-08-27:backup:INFO: File Position Binlog_Do_DB Binlog_Ignore_DB mysql-bin.000026 107 mybak-2013-08-27:backup:INFO: innodb-data=/mydata/data/ibdata1; mybak-2013-08-27:backup:INFO: innodb-logs=/mydata/data/./ib_logfile* mybak-2013-08-27:backup:INFO: raw-databases-snapshot=test shop mysql performance_schema bbs mybak-2013-08-27:backup:INFO: PHASE END: Creating snapshot based backup mybak-2013-08-27:backup:INFO: PHASE START: Calculating backup size & checksums mybak-2013-08-27:backup:INFO: next-binlog=mysql-bin.000026 mybak-2013-08-27:backup:INFO: backup-size=35.41 MB mybak-2013-08-27:backup:INFO: PHASE END: Calculating backup size & checksums mybak-2013-08-27:backup:INFO: PHASE START: Compression/Encryption mybak-2013-08-27:backup:INFO: compress=/usr/bin/gzip mybak-2013-08-27:backup:INFO: backup-size-compressed=1.60 MB mybak-2013-08-27:backup:INFO: PHASE END: Compression/Encryption mybak-2013-08-27:backup:INFO: read-locks-time=00:00:01 mybak-2013-08-27:backup:INFO: flush-logs-time=00:00:01 mybak-2013-08-27:backup:INFO: compress-encrypt-time=00:00:20 mybak-2013-08-27:backup:INFO: backup-time=00:00:09 mybak-2013-08-27:backup:INFO: backup-status=Backup succeeded mybak-2013-08-27:backup:INFO: Backup succeeded mybak-2013-08-27:backup:INFO: PHASE START: Running post backup plugin mybak-2013-08-27:backup:INFO: PHASE END: Running post backup plugin mybak-2013-08-27:backup:INFO: PHASE START: Mailing backup report mybak-2013-08-27:backup:INFO: PHASE END: Mailing backup report mybak-2013-08-27:backup:INFO: PHASE START: Cleanup mybak-2013-08-27:backup:INFO: PHASE END: Cleanup mybak-2013-08-27:backup:INFO: END OF BACKUP /usr/bin/mysql-zrm started successfully [root@master ~]# du /backup/zrm/mybak-`date +%F`/* -sh 1.7M /backup/zrm/mybak-2013-08-27/20130827012922
[root@master mysql-zrm]# mysql-zrm-scheduler --now --backup-level 1 --backup-set mybak-`date +%F` schedule:INFO: ZRM for MySQL Community Edition - version 3.0 Logging to /var/log/mysql-zrm/mysql-zrm-scheduler.log backup:INFO: ZRM for MySQL Community Edition - version 3.0 mybak-2013-08-27:backup:INFO: START OF BACKUP mybak-2013-08-27:backup:INFO: PHASE START: Initialization mybak-2013-08-27:backup:WARNING: The lvm-snapshot option is deprecated. Use snapshot-size instead mybak-2013-08-27:backup:INFO: backup-set=mybak-2013-08-27 mybak-2013-08-27:backup:INFO: backup-date=20130827013928 mybak-2013-08-27:backup:INFO: mysql-server-os=Linux/Unix mybak-2013-08-27:backup:INFO: backup-type=regular mybak-2013-08-27:backup:INFO: host=localhost mybak-2013-08-27:backup:INFO: backup-date-epoch=1377538768 mybak-2013-08-27:backup:INFO: retention-policy=1W mybak-2013-08-27:backup:INFO: mysql-zrm-version=ZRM for MySQL Community Edition - version 3.0 mybak-2013-08-27:backup:INFO: mysql-version=5.5.28-log mybak-2013-08-27:backup:INFO: backup-directory=/backup/zrm/mybak-2013-08-27/20130827013928 mybak-2013-08-27:backup:INFO: backup-level=1 mybak-2013-08-27:backup:INFO: PHASE END: Initialization mybak-2013-08-27:backup:INFO: PHASE START: Running pre backup plugin mybak-2013-08-27:backup:INFO: PHASE END: Running pre backup plugin mybak-2013-08-27:backup:INFO: PHASE START: Flushing logs mybak-2013-08-27:backup:INFO: PHASE END: Flushing logs mybak-2013-08-27:backup:INFO: PHASE START: Creating incremental backup src = /mydata/data/mysql-bin.000026 k = /backup/zrm/mybak-2013-08-27/20130827013928/mysql-bin.000026 mybak-2013-08-27:backup:INFO: incremental=mysql-bin.[0-9]* mybak-2013-08-27:backup:INFO: PHASE END: Creating incremental backup mybak-2013-08-27:backup:INFO: PHASE START: Calculating backup size & checksums mybak-2013-08-27:backup:INFO: next-binlog=mysql-bin.000027 mybak-2013-08-27:backup:INFO: last-backup=/backup/zrm/mybak-2013-08-27/20130827012922 mybak-2013-08-27:backup:INFO: backup-size=0.00 MB mybak-2013-08-27:backup:INFO: PHASE END: Calculating backup size & checksums mybak-2013-08-27:backup:INFO: PHASE START: Compression/Encryption mybak-2013-08-27:backup:INFO: compress=/usr/bin/gzip mybak-2013-08-27:backup:INFO: backup-size-compressed=0.00 MB mybak-2013-08-27:backup:INFO: PHASE END: Compression/Encryption mybak-2013-08-27:backup:INFO: read-locks-time=00:00:00 mybak-2013-08-27:backup:INFO: flush-logs-time=00:00:01 mybak-2013-08-27:backup:INFO: compress-encrypt-time=00:00:00 mybak-2013-08-27:backup:INFO: backup-time=00:00:01 mybak-2013-08-27:backup:INFO: backup-status=Backup succeeded mybak-2013-08-27:backup:INFO: Backup succeeded mybak-2013-08-27:backup:INFO: PHASE START: Running post backup plugin mybak-2013-08-27:backup:INFO: PHASE END: Running post backup plugin mybak-2013-08-27:backup:INFO: PHASE START: Mailing backup report mybak-2013-08-27:backup:INFO: PHASE END: Mailing backup report mybak-2013-08-27:backup:INFO: PHASE START: Cleanup mybak-2013-08-27:backup:INFO: PHASE END: Cleanup mybak-2013-08-27:backup:INFO: END OF BACKUP /usr/bin/mysql-zrm started successfully [root@master mysql-zrm]# du /backup/zrm/mybak-`date +%F`/* -sh 40M /backup/zrm/mybak-2013-08-27/20130827012922 16K /backup/zrm/mybak-2013-08-27/20130827013928
[root@master mysql-zrm]# mysql-zrm-parse-binlogs --backup-set mybak-`date +%F` --source-directory /backup/zrm/mybak-2013-08-27/20130827012922/ parse-binlogs:INFO: ZRM for MySQL Community Edition - version 3.0 mybak-2013-08-27:parse-binlogs:ERROR: /backup/zrm/mybak-2013-08-27/20130827012922/ contains a full backup and there are no binary logs in this directory.
[root@master mysql-zrm]# mysql-zrm-parse-binlogs --backup-set mybak-`date +%F` --source-directory /backup/zrm/mybak-2013-08-27/20130827013928/ parse-binlogs:INFO: ZRM for MySQL Community Edition - version 3.0 <table border=1> <tr> <td> Log filename </td><td> Log Position </td><td> Timestamp </td><td> Event Type </td><td> Event </td></tr> <tr> <td> /backup/zrm/mybak-2013-08-27/20130827013928/mysql-bin.000026 </td> <td> 4 </td> <td> 13-08-27 01:29:25 </td> <td> Start: binlog v 4, server v 5.5.28-log created 130827 1:29:25 </td> <td> </td></tr> <tr> <td> /backup/zrm/mybak-2013-08-27/20130827013928/mysql-bin.000026 </td> <td> 107 </td> <td> 13-08-27 01:33:00 </td> <td> Query </td> <td> /*!\C utf8 *//*!*/; <br>BEGIN <br>/*!*/; <br> </td></tr> <tr> <td> /backup/zrm/mybak-2013-08-27/20130827013928/mysql-bin.000026 </td> <td> 179 </td> <td> 13-08-27 01:33:00 </td> <td> Intvar </td> <td> </td></tr> <tr> <td> /backup/zrm/mybak-2013-08-27/20130827013928/mysql-bin.000026 </td> <td> 207 </td> <td> 13-08-27 01:33:00 </td> <td> Query </td> <td> insert into shop.ecs_users(user_name,last_time) values('week0',now()) <br>/*!*/; <br> </td></tr> <tr> <td> /backup/zrm/mybak-2013-08-27/20130827013928/mysql-bin.000026 </td> <td> 343 </td> <td> 13-08-27 01:33:00 </td> <td> Query </td> <td> COMMIT <br>/*!*/; <br> </td></tr> <tr> <td> /backup/zrm/mybak-2013-08-27/20130827013928/mysql-bin.000026 </td> <td> 416 </td> <td> 13-08-27 01:39:28 </td> <td> Rotate to mysql-bin.000027 pos: 4 </td> <td> </td></tr> </table>
mysql> drop database shop; Query OK, 88 rows affected (0.06 sec)
[root@master mysql-zrm]# mysql-zrm-reporter --show restore-info --where backup-set=mybak-2013-08-27 REPORT TYPE : restore-info backup_set backup_date backup_level backup_directory backup_status comment ----------------------------------------------------------------------------------------------------------------------------------------------------- mybak-2013-08-27 Tue 27 Aug 2013 01:39:28 1 /backup/zrm/mybak-2013-08-27/20130827013 Backup succeeded ---- AM CST 928 mybak-2013-08-27 Tue 27 Aug 2013 01:29:22 0 /backup/zrm/mybak-2013-08-27/20130827012 Backup succeeded ---- AM CST 922
[root@master mysql-zrm]# mysql-zrm --action restore --backup-set mybak-2013-08-27 --source-directory /backup/zrm/mybak-2013-08-27/20130827012922/ restore:INFO: ZRM for MySQL Community Edition - version 3.0 mybak-2013-08-27:restore:WARNING: The lvm-snapshot option is deprecated. Use snapshot-size instead mybak-2013-08-27:restore:INFO: Restored innodb log '/mydata/data/ib_logfile0' mybak-2013-08-27:restore:INFO: Restored innodb log '/mydata/data/ib_logfile1' mybak-2013-08-27:restore:INFO: Restored innodb data file '/mydata/data/ibdata1' mybak-2013-08-27:restore:INFO: Restored database from raw backup: test mybak-2013-08-27:restore:INFO: Restored database from raw backup: shop mybak-2013-08-27:restore:INFO: Restored database from raw backup: mysql mybak-2013-08-27:restore:INFO: Restored database from raw backup: performance_schema mybak-2013-08-27:restore:INFO: Restored database from raw backup: bbs mybak-2013-08-27:restore:INFO: Restore done in 42 seconds. MySQL server has been shutdown. Please restart after verification. [root@master ~]# service mysqld start Starting MySQL... SUCCESS! mysql> select user_id,user_name,last_time from shop.ecs_users; +---------+-----------+---------------------+ | user_id | user_name | last_time | +---------+-----------+---------------------+ | 1 | ecshop | 0000-00-00 00:00:00 | | 2 | vip | 0000-00-00 00:00:00 | | 3 | text | 0000-00-00 00:00:00 | | 5 | zuanshi | 0000-00-00 00:00:00 | +---------+-----------+---------------------+ 4 rows in set (0.00 sec)
[root@master mysql-zrm]# mysql-zrm --action restore --backup-set mybak-2013-08-27 --source-directory /backup/zrm/mybak-2013-08-27/20130827013928/ restore:INFO: ZRM for MySQL Community Edition - version 3.0 mybak-2013-08-27:restore:WARNING: The lvm-snapshot option is deprecated. Use snapshot-size instead mybak-2013-08-27:restore:INFO: BINLOG = mysqlbinlog --user="backup-user" --password="*****" --host="localhost" --socket="/tmp/mysql.sock" "/backup/zrm/mybak-2013-08-27/20130827013928/"/mysql-bin.[0-9]* >> /tmp/e88CEUVrrj mybak-2013-08-27:restore:INFO: Incremental restore done mybak-2013-08-27:restore:INFO: Restore done in 0 seconds. mysql> select user_id,user_name,last_time from shop.ecs_users; +---------+-----------+---------------------+ | user_id | user_name | last_time | +---------+-----------+---------------------+ | 1 | ecshop | 0000-00-00 00:00:00 | | 2 | vip | 0000-00-00 00:00:00 | | 3 | text | 0000-00-00 00:00:00 | | 5 | zuanshi | 0000-00-00 00:00:00 | | 6 | week0 | 2013-08-27 01:33:00 | +---------+-----------+---------------------+ 5 rows in set (0.01 sec)
#!/bin/bash # # Written by Sanyu ,not tested # Name1=lvm-month Name2=lvm-week mkdir /backup/zrm 2>/dev/null mkdir /etc/mysql-zrm/$Name1 mkdir /etc/mysql-zrm/$Name2 mkconf () { cat >$1<<END backup-level=0 backup-mode=raw lvm-snapshot=100M snapshot-plugin="/usr/share/mysql-zrm/plugins/lvm-snapshot.pl" backup-type=regular destination=/backup/zrm retention-policy=1W compress=1 compress-plugin=/usr/bin/gzip all-databases=1 user="backup-user" password="redhat" host="localhost" socket=/tmp/mysql.sock mysql-binlog-path="/mydata/data" mailto="[email protected]" END } mkconf /etc/mysql-zrm/$Name1/mysql-zrm.conf mkconf /etc/mysql-zrm/$Name2/mysql-zrm.conf sed -i 's/retention-policy=1W/retention-policy=1Y/' /etc/mysql-zrm/$Name1/mysql-zrm.conf sed -i 's/retention-policy=1W/retention-policy=1M/' /etc/mysql-zrm/$Name1/mysql-zrm.conf mysql-zrm-scheduler --add --interval monthly --day-of-month 1 --backup-level 0 --start-time 02:04 --backup-set $Name1 mysql-zrm-scheduler --add --interval weekly --day-of-week 0 --backup-level 0 --start-time 04:04 --backup-set $Name2 mysql-zrm-scheduler --add --interval daily --backup-level 1 --start-time 04:04 --backup-set $Name2 mysql-zrm-scheduler --query [root@master ~]# ./zrm.sh schedule:INFO: ZRM for MySQL Community Edition - version 3.0 Logging to /var/log/mysql-zrm/mysql-zrm-scheduler.log DONE schedule:INFO: ZRM for MySQL Community Edition - version 3.0 Logging to /var/log/mysql-zrm/mysql-zrm-scheduler.log DONE schedule:INFO: ZRM for MySQL Community Edition - version 3.0 Logging to /var/log/mysql-zrm/mysql-zrm-scheduler.log DONE schedule:INFO: ZRM for MySQL Community Edition - version 3.0 Logging to /var/log/mysql-zrm/mysql-zrm-scheduler.log 4 2 1 * * /usr/bin/zrm-pre-scheduler --action backup --backup-set lvm-month --backup-level 0 --interval monthly (保存一年) 4 4 * * 0 /usr/bin/zrm-pre-scheduler --action backup --backup-set lvm-week --backup-level 0 --interval weekly (保存一月) 4 4 * * * /usr/bin/zrm-pre-scheduler --action backup --backup-set lvm-week --backup-level 1 --interval daily (保存一月)