MySQL Database backup-zrm

Source: Internet
Author: User

ZRM is an acronym for Zmanda Recovery Manager, an open source software for backing up MySQL.

It is http://dl.fedoraproject.org/pub/epel/6/x86_64/repoview/MySQL-zrm.html

First, installation

#yum install-y MYSQL-ZRM

Second, create an alternate user

#mysql-uroot-p

Mysql>grant select,insert,update,create,drop,reload,shutdown,alter,super,lock table,replication Client on * * to ' Backup ' @ ' localhost ' identified by ' backup ';

Mysql>flush Privileges

Third, configuration file modification

#cd/ETC/MYSQL-ZRM

It is recommended that you create a directory for each database that needs to be backed up, such as backing up a Linux database, creating a Linux directory

#mkdir Linux

#cp-a mysql-zrm.conf Linux

#cd Linux

#vim mysql-zrm.conf

   backup-level=0                  #

backup-mode=logical #备份方式, select as logical backup

Destination=/data/backuP #备份数据存放目录, default under/var/log/mysql-zrm

retention-policy=4w #备份文件保存时间, 4W is one months

Compress=1 #备份文件选择压缩, using gzip

databases=linux #选择要备份的数据库为linux

user= "Backup" #备份用户

password= "Backup" #备份用户密码

Socket=/var/lib/mysql/mysql.sock

Verbose=1 #记录详细信息

Iv. Backing up data

#mysql-zrm-scheduler--now--backup-set Linux A full backup of the Linux database in its current state

#mysql-zrm-scheduler--add--interval weekly--start 1--day-of-week 0--backup-level Linux specify 13 points per week to Lin UX database make a full backup

#mysql-zrm-scheduler--add--interval daily--start--backup-level 1--backup-set linux Specifies to make an incremental backup of the database 1 points per day

#crontab-L

0 1 * * */usr/bin/zrm-pre-scheduler--action backup--backup-set linux--backup-level 1--interval daily

0 1 * * 1/usr/bin/zrm-pre-scheduler--action backup--backup-set Linux--backup-level 0--interval Weekly

Five, backup data query

#mysql-zrm-scheduler--query View Backup Schedule

#mysql-zrm-reporter--where backup-set=linux--show backup-status-info View backup Status

#mysql-zrm-reporter--where backup-set=linux--show backup-performance-info View Backup results

#mysql-zrm--action verify-backup--backup-set linux--verbose Verifying backup results

Vi. Recovery

#mysql-zrm-reporter--show restore-info where backup-set=linux view backup data

#mysql-zrm--action restore--source=directory/var/lib/mysql-zrm/linux/20140821160716/--backup-set linux--verbose for recovery


This article is from the "Bremen Band" blog, declined reprint!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.