1 Introduction
Abbreviation: PXB XBK
XtraBackup is an open source project of Percona, which is used to achieve functions similar to InnoDB's official hot backup tool, InnoDB Hot Backup, and supports online hot backup.
Support full backup and incremental backup.
Similar to cp, the backup rate depends on the IO reading capability.
**Limitations: **Only local backup.
Summary of XBK copy logic:
Three steps: 1. Copy the data files ibdataN, undo00N, ibtmpN, ibd+redo of the innodb table
2. Copy the new data during copying, intercept the redo (lsn number)
3. Copy the non-innodb table The file and the frm file of the innodb table frm, myi, myd
xtrabackup --> C C++ backup innodb table after 8.0
innobacpex --> perl language backup non-innodb table
2. Installation
Version selection:
Before mysql8.0, 2.4.x
After mysql8.0, 8.0
Official website: https://www.percona.com/downloads/
Method one: yum way
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum -y install perl perl-devel libaio libaio-devel perl-Time-HiRes perl-DBD-MySQL libev
wget https://www.percona.com/downloads/Percona-XtraBackup-2.4/Percona-XtraBackup-2.4.20/binary/redhat/7/x86_64/percona-xtrabackup-24-2.4.20-1.el7.x86_64.rpm
yum install -y percona-xtrabackup.x86_64
Method 2: Download the binary method
https://www.percona.com/downloads/Percona-XtraBackup-2.4/LATEST/
percona-xtrabackup-2.4.20-Linux-x86_64.el7.tar.gz
Upload software: rz -y
ll
-rw-r–r-- 1 root root 98490755 Jul 13 11:15 percona-xtrabackup-2.4.20-Linux-x86_64.el7.tar.gz
Decompression software, soft connection:
tar -xf percona-xtrabackup-2.4.20-Linux-x86_64.el7.tar.gz
mv percona-xtrabackup-2.4.20-Linux-x86_64 /usr/local/xtrabackup
ln -s /usr/local/xtrabackup/bin/* /usr/bin/
3. Check the version and command path
Check the version and command directory:
which innobackupex
/usr/bin/innobackupex
which xtrabackup
/usr/bin/xtrabackup
innobackupex --version
innobackupex version 2.3.6 Linux (x86_64) (revision id: )
4. Backup implementation
4.1 Add a configuration file so that XBK can recognize the socket file. Vim cannot be recognized under mysql
/etc/my.cnf
[client]
socket=/tmp/mysql.sock
4.2 Create a backup directory, backup
mkdir -p /data/backup/pxb
innobackupex --user=root --password=123 /data/backup/pxb
4.3 Complete the backup check four important files:
xtrabackup_binlog_info # Record the binlog location point, the starting point of binlog interception
xtrabackup_checkpoints # LSN number information, for the next increment
xtrabackup_info # Backup overview information
xtrabackup_logfile # Redo changes generated during the backup
For more exciting content, please follow the WeChat public account to get