MySQL uses Xtrabackupex to summarize the full-database backup process

Source: Internet
Author: User
MySQL uses Xtrabackupex to summarize the full-database backup process

MySQL uses Xtrabackupex to summarize the full-database backup process

1. Introduction to xtrabackup

MySQL management-using XtraBackup for Hot Backup

MySQL open-source backup tool Xtrabackup backup deployment

MySQL Xtrabackup backup and recovery

Use XtraBackup to implement MySQL master-slave replication and quick deployment [master-slave table lock-free]

Install and use Xtrabackup from Percona to back up MySQL

2. Download xtrabackup

Is:

Under the Chorm browser, under "downloadpercona xtrabackup", select the version number and OS version. If some browsers cannot open, the following error may occur:

You can also use wget for download in linux:

Wget

3. Install xtrabackup 3.1 and configure datadir

Check whether datadir has been configured and whether mysql service exists. If yes, set datadir in the my. cnf configuration file.

[Root @ data01 ~] # More/etc/my. cnf | grepdatadir

[Root @ data01 ~] #

OK. If datadir is not configured, configure it in my. cnf.

Vim my. cnf

Datadir =/home/data/mysql/data

Check again:

[Root @ data01 ~] # More/etc/my. cnf | grepdatadir

Datadir =/home/data/mysql/data

[Root @ data01 ~] #

[Root @ data01 ~] #

3.2 decompress

Tar -xvfpercona-xtrabackup-2.2.9-5067-Linux-x86_64.tar.gz

3.3 copy to/usr/bin/

Cp./percona-xtrabackup-2.2.9-Linux-x86_64/bin/innobackupex/usr/bin/innobackupex

Cp./percona-xtrabackup-2.2.9-Linux-x86_64/bin/xtrabackup/usr/bin/xtrabackup

Cp./percona-xtrabackup-2.2.9-Linux-x86_64/bin/xbcrypt/usr/bin/xbcrypt

Cp./percona-xtrabackup-2.2.9-Linux-x86_64/bin/xbstream/usr/bin/xbstream

PS: the new version does not have the innobackupex-1.5.1 plug-in.

3.4 check whether xtrabackup is available

[Root @ data01 ~] # Innobackupex -- help | more

Options:

-- Apply-log

Prepare a backup in BACKUP-DIR by applying the transaction log file

Named "xtrabackup_logfile" located in the same directory. Also,

Create new transaction logs. The InnoDB configuration is read from

The file "backup-my.cnf ".

-- Backup-locks

This option controls if backup locks shoshould be used instead of FLUSH

Tables with read lock on the backup stage. The option has no effect

When backup locks are not supported by the server. This option is

Enabled by default, disable with -- no-backup-locks.

3.5 source code Installation

Refer:

4. Two major tool components

Xtrabackup: supports innodb Storage engine tables and xtradb storage engine tables.

Innobackupex: supports innodb Storage engine tables, xtradb storage engine tables, and myisam storage engine tables.

5. Some Important Parameters

-- Defaults-file

Same as the -- defaults-file parameter of xtrabackup

-- Apply-log

Encapsulation of the -- prepare parameter of xtrabackup

-- Copy-back

Copy the backup data file to the datadir of the MySQL server during data recovery;

-- Remote-host = HOSTNAME

Store the backup data to the process server through ssh;

-- Stream = [tar]

The output format of the backup file. tar4ibd is used for tar. This file can be obtained from the XtarBackup binary file. if -- stream = tar is specified during backup, the Directory of the tar4ibd file must be in $ PATH (because tar4ibd is used for compression, the file can be obtained in the binary package of XtraBackup ).

When you use stream = tar for backup, your xtrabackup_logfile may be temporarily stored in the/tmp directory, if the number of concurrent writes during Backup is large, the xtrabackup_logfile may be large (5 GB +) and may be full of your/tmp directory, you can solve this problem by specifying the directory with the -- tmpdir parameter.

-- Tmpdir = DIRECTORY

When -- remote-host or -- stream is specified, the temporary directory of transaction logs is stored. The tmpdir directory specified in the MySQL configuration file is used by default.

-- Redo-only -- apply-log group,

Only redo logs are supported during forced backup and rollback is skipped. This is necessary for Incremental backup.

-- Use-memory = #

This parameter is used when prepare is used to control the amount of memory used by the innodb instance in prepare to replace my. buffer_pool_size value in cnf. If you are an independent server and the memory is large enough, you can increase the value of -- use-memory to speed up Backup recovery.

-- Throttle = IOS

Same as the -- throttle parameter of xtrabackup

-- Sleep = is used for ibbackup. It specifies the number of milliseconds for stopping copying every 1 MB of data during backup. It is also used to minimize the impact on normal services during Backup, for details, refer to the ibbackup manual;

-- Compress [= LEVEL]

Compresses the volume of backup data. Only ibbackup is supported, and xtrabackup is not implemented yet;

-- Include = REGEXP

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.