MySQL Backup: How to use Xtrabackup

Source: Internet
Author: User
Tags mysql backup


Xtrabackup:

Advantages of Xtrabackup:
1. Fast, support parallel backup. --parallel=8
2. Online backup backup, do not block read/write (INNODB), add global lock to MyISAM
3. Support to build master-slave copy Online

Basic practical methods of Xtrabackup:


--Fully prepared
Innobackupex--defaults-file=/etc/my.cnf--user=root--socket=/var/lib/mysql/mysql.sock--parallel=8/home/backup/

/home/backup: Directory for full file storage

--Make the first incremental backup on the full backup directory
Innobackupex--user=root--socket=/var/lib/mysql/mysql.sock--defaults-file=/etc/my.cnf--parallel=8--incremental/ home/backup/--incremental-basedir=/home/backup/2014-06-22_20-10-49/

/home/backup: The stored directory for incremental backups
--INCREMENTAL-BASEDIR=/HOME/BACKUP/2014-06-22_20-10-49: Fully-prepared catalogue

--incremental backup on the basis of the last incremental backup
Innobackupex--user=root--socket=/var/lib/mysql/mysql.sock--defaults-file=/etc/my.cnf--parallel=8--incremental/ home/backup/--incremental-basedir=/home/backup/2014-06-22_20-23-18/

/home/backup: The storage directory for the second incremental backup
--incremental-basedir: Directory of the last incremental backup


Stop MySQL Service
Service MySQL Stop

Restore the database:

Consolidated Backup:

Innobackupex--apply-log--redo-only/home/backup/2014-06-22_20-10-49/

Merge the first backup into a full standby
Innobackupex--apply-log--redo-only--incremental/home/backup/2014-06-22_20-10-49/--incremental-dir=/home/backup /2014-06-22_20-23-01

Merging a second backup into full standby
Innobackupex--apply-log--incremental/home/backup/2014-06-22_20-10-49/--incremental-dir=/home/backup/2014-06-22 _20-23-18

Copy the fully-prepared file to the database directory (make sure the database directory is empty)
Innobackupex--defaults-file=/etc/my.cnf--user=root--copy-back/home/backup/2014-06-22_20-10-49/

Change Database directory permissions:
Chown mysql:mysql/var/lib/mysql/-R

Turn on MySQL service
Service MySQL Start

RELATED links:

Xtrabackup Principle of Backup
http://sofar.blog.51cto.com/353572/1313649
Parameter explanation:
Http://www.linuxidc.com/Linux/2014-01/95132.htm

Using Xtrabackup to build master-slave replication on large database online
http://navyaijm.blog.51cto.com/4647068/1422229
Xtrabackup for incremental backup and recovery
http://blog.csdn.net/justdb/article/details/17054667

This article is from the "SQL Server MySQL" blog, so be sure to keep this source http://dwchaoyue.blog.51cto.com/2826417/1429918

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.