Xtrabackup of mysql backup tools

Source: Internet
Author: User
Tags mysql backup percona
Xtrabackup is a data backup tool for the InnoDB Storage engine. It supports online Hot Backup (which does not affect Data Reading and Writing during Backup) and is a good alternative to InnoDBHotbackup, a commercial backup tool. Xtrabackup has two

Xtrabackup is a data backup tool for the InnoDB Storage engine. It supports online Hot Backup (which does not affect Data Reading and Writing during Backup) and is a good alternative to InnoDBHotbackup, a commercial backup tool. Xtrabackup has two

Xtrabackup is a data backup tool for the InnoDB Storage engine. It supports online Hot Backup (which does not affect Data Reading and Writing during Backup) and is a good alternative to InnoDB Hotbackup. xtrabackup has two main tools: xtrabackup and innobackupex. You can only back up tables of InnoDB and XtraDB storage engines, but cannot back up MyISAM data tables.

1. download and install the xtrabackup Tool

[Root @ tong2 ~] # Wget

[Root @ tong2 ~] # Tar xvf Percona-XtraBackup-2.2.7-r5050-el6-x86_64-bundle.tar

[Root @ tong2 ~] # Ll percona-xtrabackup -*
-Rw-r --. 1 root 4863276 Dec 4 22:18 percona-xtrabackup-2.2.7-5050.el6.x86_64.rpm
-Rw-r --. 1 root 648012 Dec 4 22:18 percona-xtrabackup-debuginfo-2.2.7-5050.el6.x86_64.rpm
-Rw-r --. 1 root 961432 Dec 4 22:18 percona-xtrabackup-test-2.2.7-5050.el6.x86_64.rpm [root @ tong2 ~] # Yum localinstall percona-xtrabackup-*-y

[Root @ tong2 ~] # Rpm-ql percona-xtrabackup-2.2.7-5050.el6.x86_64.
/Usr/bin/innobackupex
/Usr/bin/xbcrypt
/Usr/bin/xbstream
/Usr/bin/xtrabackup
/Usr/share/doc/percona-xtrabackup-2.2.7
/Usr/share/doc/percona-xtrabackup-2.2.7/COPYING
[Root @ tong2 ~] #

2. Create databases and innodb tables

[Root @ tong2 ~] # Mysql-u root-p
Enter password:
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 16
Server version: 5.6.21-log MySQL Community Server (GPL)

Copyright (c) 2000,201 4, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.

Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.

Mysql> \ u tong
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with-

Database changed

Mysql> create table t (a int) engine = innodb;
Query OK, 0 rows affected (0.27 sec)

Mysql> insert into t values (1), (2), (3), (4), (5 );
Query OK, 5 rows affected (0.03 sec)
Records: 5 Duplicates: 0 Warnings: 0

Mysql> select * from t;
+ ------ +
| A |
+ ------ +
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
+ ------ +
5 rows in set (0.00 sec)

Mysql> exit
Bye
[Root @ tong2 ~] #

3. Complete backup of innodb Storage engine tables

[Root @ tong2 ~] # Innobackupex -- help | more -- View help information

[Root @ tong2 ~] # Innobackupex -- user = root -- password = system/opt/tong 2>/opt/tong/backup. log

[Root @ tong2 ~] # Ll/opt/tong/2015-01-04_16-00-37/
Total 12324
-Rw-r --. 1 root 295 Jan 4 backup-my.cnf
-Rw-r -----. 1 root 12582912 Jan 4 16:00 ibdata1
Drwx ------. 2 root 4096 Jan 4 16: 00 mysql
Drwxr-xr-x. 2 root 4096 Jan 4 16:00 performance_schema
Drwxr-xr-x. 2 root 4096 Jan 4 16: 00 test
Drwx ------. 2 root 4096 Jan 4 16: 00 tong
-Rw-r --. 1 root 22 Jan 4 16:00 xtrabackup_binlog_info -- binary log information
-Rw-r -----. 1 root 89 Jan 4 xtrabackup_checkpoints -- backup data checkpoint
-Rw-r --. 1 root 553 Jan 4 16:00 xtrabackup_info -- backup information
-Rw-r -----. 1 root 2560 Jan 4 xtrabackup_logfile -- Log File

[Root @ tong2 ~] # Innobackupex -- user = root -- password = system -- databases = tong/opt/tong -- back up the specified database 2>/opt/tong/backup. log
[Root @ tong2 ~] # Ll/opt/tong/2015-01-04_16-02-36/
Total 12312
-Rw-r --. 1 root 295 Jan 4 backup-my.cnf
-Rw-r -----. 1 root 12582912 Jan 4 16:02 ibdata1
Drwx ------. 2 root 4096 Jan 4 16:02 tong
-Rw-r --. 1 root 22 Jan 4 16:02 xtrabackup_binlog_info
-Rw-r -----. 1 root 89 Jan 4 16:02 xtrabackup_checkpoints
-Rw-r --. 1 root 570 Jan 4 16:02 xtrabackup_info
-Rw-r -----. 1 root 2560 Jan 4 16:02 xtrabackup_logfile
[Root @ tong2 ~] #

4. Add Incremental backup to the full backup

[Root @ tong2 ~] # Innobackupex -- user = root -- password = system -- incremental-basedir =/opt/tong/2015-01-04_17-34-25 // opt/tong

-- Incremental Backup

-- Incremental-basedir -- path of the complete backup file

/Opt/tong -- storage location of Incremental Backup Files

5. Compression during full backup to save resources

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.