Xtrabackup backup MySQL

Source: Internet
Author: User
Tags percona

Xtrabackup backup MySQL
Mysqldump is based on a logical backup, which is equivalent to re-executing the SQL statement. Xtrabackup is equivalent to a physical backup of a file.

Installation dependencies
wget ftp://rpmfind.net/linux/dag/redhat/el6/en/x86_64/dag/RPMS/libev-4.15-1.el6.rf.x86_64.rpm
RPM-IVH libev-4.15-1.el6.rf.x86_64.rpm

Installing Xtrabackup
Yum Install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm
Yum List | grep Percona
Yum Install Percona-xtrabackup

All backup Optional Parameters--databases=xtra_test--host=192.168.200.51--password=123456#

Innobackupex--defaults-file=/etc/my.cnf--user=root/backup
Generate a fully-prepared file/backup/2018-01-23_21-16-32

Simulating write data
Insert into Travelrecord (id,user_id,traveldate,fee,days) VALUES (50004023, ' test ', 20160102,100,10);

Incremental backup based on full provisioning
Innobackupex--defaults-file=/etc/my.cnf--user=root--incremental--incremental-basedir=/backup/2018-01-23_ 21-16-32/backup/zengliang
Generate File/backup/zengliang/2018-01-23_21-25-20

Check for complete data consistency
Innobackupex--apply-log--redo-only/backup/2018-01-23_21-16-32

Apply Delta 1 to a full backup (last time no--fedo-only)
Innobackupex--apply-log/backup/2018-01-23_21-16-32--incremental-dir=/backup/zengliang/2018-01-23_21-25-20

Restore data
Service Mysqld Stop
Mv/var/lib/mysql/var/lib/mysqlold
Mkdir/var/lib/mysql
Innobackupex--defaults-file=/etc/my.cnf--user=root--copy-back/backup/2018-01-23_21-16-32
Chown-r Mysql:mysql/var/lib/mysql
Service mysqld Start
You can see that the data is in, and the data that is being written is also in.

Xtrabackup_binlog_info: Record the current latest log Position
Xtrabackup_binlog_pos_innodb:innodb Log postion
Xtrabackup_checkpoints: Store the starting position of the backup BEGINLSN and end position ENDLSN, incremental backup requires this lsn[incremental backup to see the changes from and to two values in this area
Xtrabackup_info: Some specific information logs for backup

Re-test to make a full backup recovery
Simulating write data
Insert into Travelrecord (id,user_id,traveldate,fee,days) VALUES (50004063, ' GoGoGo ', 20160102,100,10);
Innobackupex--defaults-file=/etc/my.cnf--user=root/backup
Generate File/backup/2018-01-23_21-44-19/

Check for complete data consistency
Innobackupex--apply-log--redo-only/backup/2018-01-23_21-44-19/
Restore data
Service Mysqld Stop
Mv/var/lib/mysql/var/lib/mysqlold1
Mkdir/var/lib/mysql
Innobackupex--defaults-file=/etc/my.cnf--user=root--copy-back/backup/2018-01-23_21-44-19/
Chown-r Mysql:mysql/var/lib/mysql
Service mysqld Start
You can see that the data is GoGoGo, and the data being written is also in.

Xtrabackup backup MySQL

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.