Xtrabackup backup MySQL

Source: Internet
Author: User
Tags install perl mysql backup percona

Installing components

Yum-y Install perl-dbi perl-dbd-mysql perl-time-hires Perl-io-socket-ssl


Visit http://www.percona.com/software/percona-toolkit/to download the latest version of Percona Toolkit

wget https://www.percona.com/downloads/percona-toolkit/2.2.15/RPM/percona-toolkit-2.2.15-1.noarch.rpm

Download the latest Termreadkey package from http://pkgs.repoforge.org/perl-TermReadKey/

wget http://pkgs.repoforge.org/perl-TermReadKey/perl-TermReadKey-2.30-3.el6.rfx.x86_64.rpm


Install this first

RPM-IVH perl-termreadkey-2.30-3.el6.rfx.x86_64.rpm

Install this again.

RPM-IVH percona-toolkit-2.2.15-1.noarch.rpm


Installing Xtrabackup

Installing components

Yum-y Install Perl-time-hires libaio* openssl*

Yum Clean All

Installing Xtrabackup

Tar zxvf percona-xtrabackup-2.2.9-5067-linux-x86_64.tar.gz-c/usr/src/

Mv/usr/src/percona-xtrabackup-2.2.9-linux-x86_64/usr/local/xtrabackup


Add a file link

Ln-s/usr/local/xtrabackup/bin/innobackupex/usr/bin/innobackupex

Ln-s/usr/local/xtrabackup/bin/xtrabackup/usr/bin/xtrabackup

Ln-s/usr/local/xtrabackup/bin/xbcrypt/usr/bin/xbcrypt

Ln-s/usr/local/xtrabackup/bin/xbstream/usr/bin/xbstream


View version

Xtrabackup-v


Test Backup Specify Library test

Innobackupex--user=root--socket=/data/3306/mysqld.sock--defaults-file=/usr/local/mysql/my.cnf--databases=test- -stream=tar/backup/mysql 2>/backup/mysql_innobackup.log | gzip >/backup/mysql/' Date +%y%m%d '. tar.gz


Common parameters are as follows:

--user=root Backup operation user name, usually root user

--password=root123 Password, because the default password is empty, so I did not add this parameter

--socket=/data/3306/mysqld.sock specifying sock files

--defaults-file=/usr/local/mysql/my.cnf Specifying a configuration file

--port=3306 Specifying ports

--host=172.17.210.112 Host IP, local can not add

--databases=test Specifies the database to be backed up, without this parameter, all databases

--parallel=4--throttle=400 parallel number, according to the host configuration selection appropriate, the default is 1, multiple can speed up the backup speed.

--stream=tar Compression type, here choose the tar format, you can add, can not add. Add a smaller file, and you'll have it packaged when you backup.

/BACKUP/MYSQL/1 The directory where the backup resides

2>/backup/mysql/innoback.log Backup logs to redirect output information from the backup process to Bak.log

1>/backup/mysql/1/' Date +%y%m%d '. tar.gz The name of the backup file after compression


Writing scripts

#!/bin/bash


echo "###############################" >>/backup/mysql.log

Statime= ' Date +%y-%m-%d ' "%h:%m:%s '

echo "$statime MySQL start Backup" >>/backup/mysql.log


Time= ' Date +%y%m%d '

Innobackupex--user=root--socket=/data/3306/mysqld.sock--defaults-file=/usr/local/mysql/my.cnf--stream=tar/ Backup/mysql 2>/backup/mysql_innobackup.log | gzip >/backup/mysql/$time. tar.gz


Statime= ' Date +%y-%m-%d ' "%h:%m:%s '

echo "$statime MySQL backup complete" >>/backup/mysql.log


#删除3天前的备份文件

Find/backup/mysql-mtime +2-type f-name "*.tar.gz"-exec rm {} \;



This article is from the "Falling Star" blog, make sure to keep this source http://xiao987334176.blog.51cto.com/2202382/1693176

Xtrabackup backup MySQL

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.