Innobackupex Incremental backup and recovery

Source: Internet
Author: User
Tags percona
Download: xtrabackup

Https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.4.8/binary/redhat/7/x86_64/Percona-XtraBackup-2.4.8-r97330f7-el7-x86_64-bundle.tar

Decompress and install yum

tar -xvf Percona-XtraBackup-2.4.8-r97330f7-el7-x86_64-bundle.taryum install percona-xtrabackup-24-2.4.8-1.el7.x86_64.rpm

Full backup

innobackupex –user=root –password=123456 –no-timestamp /backup/mysql/full

Add data in the database

Add a database db1, create table T1 in db1 (the engine of the table is InnoDB), and insert data

MariaDB [(none)]> create database if not exists db1;MariaDB [(none)]> use db1;MariaDB [db1]> create table t1(id int,name varchar(20))engine=innodb;MariaDB [db1]> insert into t1 values(1,‘aa‘);

First Incremental Backup

[[email protected] ~]# innobackupex --user=root --password=123456 --no-timestamp --incremental-basedir=/backup/mysql/full --incremental /backup/mysql/01

Add data in the database

mysql -uroot -p123456 -e "insert into db1.t1(id,name)values(2,‘100‘);"

Second Incremental Backup

[[email protected] ~]# innobackupex --user=root --password=123456 --no-timestamp --incremental-basedir=/backup/mysql/01 --incremental /backup/mysql/02

Simulate data loss and delete all contents in the database

cd /var/lib/mysql/rm -rf *

Restore full backup

[[email protected] mysql]# innobackupex --user=root --password=123456 --apply-log --redo-only /backup/mysql/full/

Restore the first Incremental Backup

[[email protected] mysql]# innobackupex --user=root --password=123456 --apply-log --redo-only /backup/mysql/full/ --incremental-dir=/backup/mysql/01

Restore the second Incremental Backup

[[email protected] mysql]# innobackupex --user=root --password=123456 --apply-log /backup/mysql/full/ --incremental-dir=/backup/mysql/02

Apply-Log

[[email protected] mysql]# innobackupex --user=root --password=123456 --copy-back /backup/mysql/full/

Set permissions

[[email protected] mysql]# chown -R mysql.mysql /var/lib/mysql/

Restart to check whether the recovery is successful

[[email protected] mysql]# systemctl restart mariadb[[email protected] mysql]# mysql -uroot -p123456 -e "select * from db1.t1;"+------+------+| id   | name |+------+------+|    1 | aa   ||    2 | 100  |+------+------+

Innobackupex Incremental backup and recovery

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.