Ensure the system is installed with Perl-dbd-mysql
Yum Install Perl-dbd-mysql
Install Xtrabackup
The Xtrabackup 2.1 version does not support the InnoDB engine, so you need to download the 2.0.* version.
Wget http://www.percona.com/downloads/XtraBackup/XtraBackup-2.0.7/RPM/rhel5/x86_64/ percona-xtrabackup-2.0.7-552.rhel5.x86_64.rpm
Performing RPM–IVH percona-xtrabackup-2.0.7-552.rhel5.x86_64.rpm is easy to install the required packages.
Perform a backup
1. Ensure the source database is in the starting state
2. Execution instruction
Innobackupex--user=yourdbuser--PASSWORD=MAGICDB1--defaults-file=/etc/my.cnf < backup directory >
The backup directory is any large enough partition
3, check the backup directory, whether to generate data
compressing and transferring files
1. TARCZVF backdir.gz Backup
2, scpbackdir.gz Ip:/dir
Recover data (executed in target database)
1, cd dir
2, Tar Xvzf backdir.gz
3, to ensure that/etc/my.cnf files have a line Datadir=dir
4, to ensure that the database directory is empty
5. Perform Innobackupex--apply-log < backup directory >
6. Perform Innobackupex--copy-back--defaults-file=/etc/my.cnf < backup directory >
Data synchronization
1. Start MySQL
2, the implementation of MySQL master-slave synchronization