从阿里云RDS备份xb文件恢复数据
2021-05-24centos8 mysql8从阿里云rds恢复物理备份数据,rds的数据库备份分两种一种是逻辑备份,就是我们常用的.sql文件,另一种就是物理备份,直接把数据库文件备份了,
1、访问https://www.percona.com/downloads/Percona-XtraBackup-LATEST/#下载安装包
https://downloads.percona.com/downloads/Percona-XtraBackup-LATEST/Percona-XtraBackup-8.0.22-15/binary/redhat/8/x86_64/percona-xtrabackup-80-8.0.22-15.1.el8.x86_64.rpm
wget https://repo.percona.com/release/8/RPMS/x86_64/qpress-11-1.el8.x86_64.rpm
2、从aliyun下xb文件
3、准备一台mysql-server
yum -y intstall mysql-server mysql
4、cat bak.xb |xbstream -x -v -C /opt/newdb
xtrabackup --decompress --remove-original --target-dir=/opt/newdb
mysqld --defaults-file=/opt/newdb/backup-my.cnf --user=mysql --datadir=/opt/newdb &
5、mysql -u root -p -S /opt/newdb/mysql.sock
6、备份数据到sql
mysqldump -uuser -p -S /opt/newdb/mysql.sock callsips > call.sql
7、恢复数据
mysql -uroot -p -D mysql < call.sql