Install and use mysql xtrabackup

Source: Internet
Author: User
Tags percona perl script

Mysql xtrabackup installation and simple use of Xtrabackup is an open-source project of percona. It is used to implement the innodb Hot Backup function similar to the InnoDB official Hot Backup Tool and can quickly back up and restore mysql databases. Xtrabackup contains two tools: xtrabackup is a tool used to hot back up data in innodb and xtradb tables. It cannot back up tables of other engines or back up data table structures; innobackupex is a perl script that encapsulates xtrabackup and provides the ability to back up myisam tables.

[Root @ aeolus1 ~] # Rpm-ivh percona-xtrabackup-2.1.3-608.rhel5.x86_64.rpm warning: percona-xtrabackup-2.1.3-608.rhel5.x86_64.rpm: Header V4 DSA signature: NOKEY, key ID cd2efd2aPreparing... ######################################## ### [100%] 1: percona-xtrabackup ##################################### ###### [100%] After installation, the following two tools are available in/usr/bin: innobackupex and xtrabackup root @ aeolus1 bin] # ll inno *-rwxr-xr-x 1 root 110738 May 23 innobackupexlrwxrwxrwx 1 root 12 jun 9 innobackupex-1.5.1-> innobackupex [root @ aeolus1 bin] # ll * xtrabackup *-rwxr-xr-x 1 root 2894280 May 23 xtrabackup-rwxr-xr-x 1 root root 4494952 May 23 xtrabackup_55-rwxr-xr-x 1 root 11633272 May 23 xtrabackup_56

 

Complete full backup process 1 create a full backup
Innobackupex  --user=root  --password=passwd  /root/mysqlbackup/

 

In this way, a full backup is created, and the backup file is stored under the directory name with the timestamp. The following options are available:
-- Defaults-file =/etc/my. cnf the mysql configuration file used for backup -- no-timestamp does not name the directory name with a timestamp

 

2. After a backup is created, the data cannot be recovered. Some committed transactions may not be undone or the transactions in the logs need to be replayed. To ensure data consistency, we need to apply the logs to the backup files.
 innobackupex --apply-log /root/mysqlbackup/2013-06-14_16-20-56

 

In this way, the backup data can be applied and restored 3 drop database mysql and then restored
 innobackupex --user=root --copy-back /root/mysqlbackup/2013-06-14_16-20-56

 

After recovery, change the permissions of the data file and start the database.
chown  -R mysql:mysql    /usr/local/mysql/data

 

Note that in the case of full recovery, Server 1 must be shut down, as long as it is partially restored, the server does not need to be shut down. 2. The datadir directory must be empty. If a file exists, -- copy-back will not be copied. 3. After each operation is completed, check whether innobackupex: completed OK exists in the log! It indicates the completion of the action.

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.