Xtrabackup using stream to output and compress backups

Source: Internet
Author: User
Tags mysql backup

mysql:5.6.29
xtrabackup:2.2.10
MySQL Data Catalog:/data/mysql
MySQL backup directory:/data/dbbak/full #确保有足够的磁盘空间

1. Installation dependent

-y install Libaio perl-Time-hires Perl-DBD-MySQL perl-IO- Socket-SSL rsync.x86_64

2, Installation Xtrabackup

-IVH percona-xtrabackup-2.2. Ten - 1. el6.x86_64.rpm

3. Create a backup account in the database

Mysql> CREATE USER 'Bkpuser'@'localhost'Identified by 'S3cret'; MySQL> GRANTRELOAD, LOCK TABLES,REPLICATIONClient,process on *.*  to 'Bkpuser'@'localhost'; MySQL>FLUSHPrivileges;

4. Using Xbstream Backup

Time Innobackupex--user=bkpuser--password=s3cret--no-timestamp--defaults-file=/etc/my.cnf/data/dbbak/full--tmpdir=/data/dbbak/full-stream=xbstream|gzip- >/data/dbbak/full/full.xbstream.gz161124 Ten: ,: -Innobackupex:connection to DatabaseServer closed161124 Ten: ,: -innobackupex:completed ok!Real0m37.613sUser0m28.506ssys 0m3.186s Decompression time gzip-D Full. xbstream.gzReal0m26.678sUser0m13.405ssys 0m2.354stime Xbstream-X< Full. XbstreamReal1m7.379sUser0m6.055ssys 0m11.173s

5. Using a tar Backup

Time Innobackupex--user=bkpuser--password=s3cret--no-timestamp--defaults-file=/etc/my.cnf/data/dbbak/full--tmpdir=/data/dbbak/full--stream=tar |gzip->/ Data/dbbak/full/full.tar.gzInnobackupex:you must Use -I--ignore-zeros) option for extraction of the tar stream.161124 Ten: the: -innobackupex:completed ok!Real0m34.934sUser0m26.500ssys 0m2.816s decompression Time tar-Ixzvf/Data/Dbbak/ Full/ Full. tar.gzReal0m27.310sUser0m12.818ssys 0m3.735s or gzip-D/Data/Dbbak/ Full/ Full. Tar.gztar-Ixvf/Data/Dbbak/ Full/ Full. TAR.GZ recommends using tar-Ixzvf/Data/Dbbak/ Full/ Full. tar.gz Decompression

6. Compare 2 types of exported file sizes

[email protected]_166_129full]  95232-rw-R--r--1 root root 48704253 Nov 10:09 full.tar.gz  -rw-R--r--1 root root 48809971 Nov 10:23 full.xbstream.gz

7. Summary
Using--stream=tar Backup, compression, decompression, has been compressed after the size is better than-stream=xbstream, recommend the use of--stream=tar mode compression, decompression can also be combined with tar.

Xtrabackup using stream to output and compress backups

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.