This blog post statement, especially suitable for the first application of the tool of the small white use, the reason to read it clear, OK, start!
1, pre-preparation:
Because MYSQL-ZRM this backup tool is a tool written in Perl, all you have to do is install some packages to provide the necessary environment for the MYSQL-ZRM tool.
Yum Install perl-dbi Perl-dbd-mysql perl-xml-parser-y
PS: (Online a lot of conformity, or copy, reprint others, do not need so complicated, just need to install these 3 bags can)
2. Create a backup user
Mysql> Grant Select,insert,update,create,drop,reload,alter,super,lock tables on * * to ' backup ' @ ' localhost ' Identified by ' backup ';
mysql> flush Privileges;
3, set up a separate storage directory for each database, so as to facilitate the management and recovery of data (in this case there are three databases)
Cd/etc/mysql-zrm
mkdir {, _1,_2}
CP mysql-zrm.conf Test
CP mysql-zrm.conf Test_1
CP mysql-zrm.conf Test_2
4, in/etc/mysql-zrm/test, test_1, test_2 directory to modify the mysql-zrm.conf configuration file: Settings include but not limited to: Backup user name, password, backup level and other parameters
Backup-level=0 #备份级别, 0 for full, 1 for add-on, or at the command-line to specify
Backup-mode=logical #备份方式, logical backup
Destination=/common #备份数据存放目录, default/var/lib/mysql-zrm/directory
retention-policy=30d #备份文件存放时间, 30 days
Compress=1 #备份压缩, gzip method
Verbose=1 #记录详细信息
database= "Test" #需要备份的数据库, respectively, in the test, test_1, test_2 directory to modify the corresponding
Database= "Test_1"
Database= "Test_2"
User= "Backup"
password= "Backup"
port=3306
Socket=/var/lib/mysql/mysql.sock
<?xml:namespace prefix= "O" >
?xml:namespace>
PS: If you need to back up all the databases, just need to change the parameters in the/etc/mysql-zrm/mysql-zrm.conf configuration file All-databases=1 can be
5, good, configured well , can be backed up!
Make a full preparation first:
[[email protected] mysql-zrm ] #mysql-zrm-scheduler--now--backup-set Test
ls/common/test/20170407091226 (This is my backup file storage directory)
Backup.sql Index Zrm_checksum
Backup-data: Backed-up data files
Index: Backup information, including backup level, backup database name, etc.
Zrm_checksum: Backup file storage directory, and backup file inspection and, in order to achieve the basis of the preparation
Are you paying attention to my red bold part? This backup is a rule!! Must be carried out in the/etc/mysql-zrm/directory (the Web many do not specify the directory, resulting in the cut out of the directory can not be backed up .... It's all tears!
/usr/bin/mysql-zrm started successfully Successful backup information
One more incremental backup:
[[Email protected]MYSQL-ZRM] #mysql-zrm-scheduler--now--backup-level=1--backup-set test
Index mysql.000163 Zrm_checksum
The right thing is to back up the Binlog log to implement the add-on, so you have to open your binlog.
6. View the backup Data information:
Mysql-zrm-reporter--show Restore-info where backup-set=test primarily indicates your backup directory
Mysql-zrm-reporter--show backup-performance-info where Backup-set xin mainly indicates backup file size, backup time, compression, etc.
7, OK, Backup is successful, and then test how to recover your data: (full and add the only difference is the backup of the recovery directory do not write wrong)
[[Email protected]]# mysql-zrm--action restore--source=/common/test/20170407091226/--backup-set test--verbose
The Ps:common directory is your backup data storage directory
OK, now that the whole process has been completed, your backup implementation, of course, because everyone's machine original environment is inconsistent, if you back up, what happened, welcome to write a message, this is to promote my own way!
This article is from the "you ' re the best" blog, declined reprint!
MYSQL-ZRM Backup tool for fully-prepared + add-on policy