赞
踩
在RDS界面单击实例名称,选择“备份恢复 > 全量备份 > 下载”,下载全量备份文件。
方式一:手动安装
下载正确版本的qpress和XtraBackup 下载MySQL:Index of mysql-local/Downloads 下载qpress工具:https://repo.percona.com/yum/release/ 下载Percona XtraBackup工具: 对于MySQL 5.6和5.7版本,下载XtraBackup 2.4.9及其以上版本。 对于MySQL 8.0版本,下载XtraBackup 8.0及其以上版本。 下载示例 MySQL 5.6 mysql-5.6.51-linux-glibc2.12-x86_64.tar.gz MySQL 5.7 mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz MySQL 8.0 mysql-8.0.26-linux-glibc2.12-x86_64.tar qpress qpress-11-1.el7.x86_64.rpm Percona XtraBackup XtraBackup 2.4.9(MySQL 5.6、5.7) XtraBackup 8.0(MySQL 8.0)
rpm -ivh qpress-11-1.el7.x86_64.rpm
tar -zxvf percona-xtrabackup-2.4.9-Linux-x86_64.tar.gz
mv percona-xtrabackup-2.4.9-Linux-x86_64 xtrabackup
echo "export PATH=$PATH:/usr/local/xtrabackup/bin" >> /etc/profile
mv xtrabackup/ /usr/local/
source /etc/profile
wget https://repo.percona.com/yum/release/7/RPMS/x86_64/qpress-11-1.el7.x86_64.rpm
rpm -ivh qpress-11-1.el7.x86_64.rpm
wget https://downloads.percona.com/downloads/Percona-XtraBackup-2.4/Percona-XtraBackup-2.4.9/binary/redhat/7/x86_64/percona-xtrabackup-24-2.4.9-1.el7.x86_64.rpm
rpm -ivh percona-xtrabackup-24-2.4.9-1.el7.x86_64.rpm --nodeps --force
wget https://downloads.percona.com/downloads/Percona-XtraBackup-8.0/Percona-XtraBackup-8.0.32-26/binary/redhat/7/x86_64/percona-xtrabackup-80-8.0.32-26.1.el7.x86_64.rpm
rpm -ivh percona-xtrabackup-80-8.0.32-26.1.el7.x86_64.rpm --nodeps --force
mkdir backupdir
解压全备文件。
说明:
解压全备文件到临时目录“backupdir”前,需要保证临时目录下为空,再进行解压,避免恢复异常。
MySQL 5.6、5.7
xbstream -x -p 4 < ./全备文件.qp -C ./backupdir/
innobackupex --parallel 4 --decompress ./backupdir
xbstream -x -p 4 < test.qp -C ./backupdir/
xtrabackup --parallel 4 --decompress --target-dir=./backupdir
find ./backupdir/ -name '*.qp' | xargs rm -f
MySQL 5.6、5.7
innobackupex --apply-log ./backupdir
MySQL 8.0
xtrabackup --prepare --target-dir=./backupdir
service mysql stop
/bin/systemctl stop mysqld.service
mv /usr/local/mysql/data /usr/local/mysql/data_bak
mkdir /usr/local/mysql/data
chown mysql:mysql /usr/local/mysql/data
MySQL 5.6、5.7
innobackupex --defaults-file=/etc/my.cnf --copy-back ./backupdir
chown -R mysql:mysql /usr/local/mysql/data
MySQL 8.0
xtrabackup --defaults-file=/etc/my.cnf --copy-back --target-dir=./backupdir
chown -R mysql:mysql /usr/local/mysql/data
如果是MySQL 5.7,需执行如下命令启动数据库:
/bin/systemctl start mysqld.service
show databases
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。