[mysql] XtraBackup安装、备份、恢复--使用概要
一、软件安装
1.1 解压安装包
tar -xvf Percona-XtraBackup-2.4.21-r5988af5-el7-x86_64-bundle.tar
1.2安装依赖包
rpm -ivh libev-4.24-6.el8.x86_64.rpm
rpm -ivh libev-4.15-1.el6.rf.x86_64.rpm
yum -y install perl-Digest-MD5
yum -y install perl-DBD-MySQL
以下参考安装:
yum -y install perl perl-devel libaio libaio-devel perl-Time-HiRes
yum install perl-DBI
1.3安装xtrabackup
rpm -ivh percona-xtrabackup-24-2.4.21-1.el7.x86_64.rpm
rpm -ivh percona-xtrabackup-24-debuginfo-2.4.21-1.el7.x86_64.rpm
rpm -ivh percona-xtrabackup-test-24-2.4.21-1.el7.x86_64.rpm
1.4安装解压工具qpress
tar xvf qpress-11-linux-x64.tar
cp qpress /usr/bin/
二、数据备份
1.创建备份用户
CREATE USER 'bkpuser'@'localhost' IDENTIFIED BY 'Xsbkpassword';
GRANT RELOAD, LOCK TABLES, PROCESS, REPLICATION CLIENT ON *.* TO 'bkpuser'@'localhost';
FLUSH PRIVILEGES;
2.备份
innobackupex --default-file=/etc/my.cnf --user=root --password=xx --compress /backup_dir/tmp/
三、数据恢复
1.解压
innobackupex --decompress ./2021-01-13_15-42-23
2.一致性文件
innobackupex --apply-log ./2021-01-13_15-42-23
3.copy数据文件
service mysql stop
cd /app/xsbank/mysql/app/mysql
mv data/ data_bak
mkdir data
mv arch arch_bak
mkdir arch
innobackupex --default-file=/etc/my.cnf --user=root --password=xx --copy-back /backup_dir/tmp/2021-01-13_15-42-23/
- 点赞
- 收藏
- 关注作者
评论(0)