MySQL Backup and recovery percona-xtrabackup implementation of incremental backup and recovery instances

Source: Internet
Author: User
Tags mysql backup percona

How to use Innobackupex
1. Full backup parameters a full backup address is fully backed up to the/data/mysql/back_up/all_testdb_20140612 directory
Innobackupex--user=root--password=123456--no-timestamp/data/mysql/back_up/all_testdb_20140612
Now the full backup directory is/data/mysql/back_up/all_testdb_20140612

2. Incremental backup
First time
SH incremental_backup.sh/data/mysql/back_up/back_up_20140601/data/mysql/back_up/all_testdb_20140612
Second time
SH incremental_backup.sh/data/mysql/back_up/back_up_20140602/data/mysql/back_up/back_up_20140601
Third time
SH incremental_backup.sh/data/mysql/back_up/back_up_20140603/data/mysql/back_up/back_up_20140602
The specific script is as follows:
Innobackupex--user=root--password=123456--no-timestamp--incremental $--incremental-basedir=$2--defaults-file=/ Etc/my.cnf
The specific directory is as follows:
Drwxr-xr-x. 7 root root 4096 June 14:29 all_testdb_20140612//full-volume backup address
Drwxr-xr-x. 7 root root 4096 June 14:31 back_up_20140601//First time backup address
Drwxr-xr-x. 7 root root 4096 June 14:32 back_up_20140602//secondary backup address
Drwxr-xr-x. 7 root root 4096 June 14:32 back_up_20140603//Third backup address
Option--incremental is specified as an incremental backup--incremental-basedir option is the directory that specifies the last incremental backup (or the full backup if it is the first incremental backup).
3. Restore
The restore operation for an incremental backup is a bit different from a full restore, and you must first use--apply-log--redo-only to operate on the full backup directory and all the incremental backup directories, and then you can restore the operation as if you were restoring the full backup.
Apply-log redo-only operations for each backup directory (including full backups)
Innobackupex--apply-log--redo-only/data/mysql/back_up/all_testdb_20140612--user=root--password=123456
Innobackupex--apply-log--redo-only/data/mysql/back_up/all_testdb_20140612--incremental-dir=/data/mysql/back_up /back_up_20140601--user=root--password=123456
Innobackupex--apply-log--redo-only/data/mysql/back_up/all_testdb_20140612--incremental-dir=/data/mysql/back_up /back_up_20140602--user=root--password=123456
Innobackupex--apply-log--redo-only/data/mysql/back_up/all_testdb_20140612--incremental-dir=/data/mysql/back_up /back_up_20140603--user=root--password=123456

The following is the same as when restoring a full backup
/etc/init.d/mysqld stop
Delete the original data
rm-rf/var/lib/mysql/*
To generate new data
Innobackupex--copy-back/data/mysql/back_up/all_testdb_20140612
Chown-r mysql.mysql/var/lib/mysql/
/etc/init.d/mysqld start

Related Article

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.