Huawei cloud rds local mysql backup file restore recovery

Restore backup files by downloading data to a self-built MySQL, make sure to restore MySQL version is not lower than the target backup source RDS for MySQL version.

Data recovery process, you can view the task processes the command:

ps -ef | grep mysql

 

Download qpress program and upload it to ECS to install.

http://www.quicklz.com/   download the file "qpress-11-linux.x64.tar", and upload it to the ECS. 

tar -xvf qpress-11-linux-x64.tar

mv qpress /usr/bin/

 

XtraBackup download the software, install it and upload to ECS.

Note:
Make sure XtraBackup to version 2.4.9 and above, otherwise the next steps will complain.

https://www.percona.com/downloads/Percona-XtraBackup-2.4/LATEST/  download the file "percona-xtrabackup-24-2.4.9-1.el7.x86_64.rpm", and upload it to the ECS.

rpm -ivh percona-xtrabackup-24-2.4.9-1.el7.x86_64.rpm --nodeps --force

 

Unzip the downloaded file on all equipment ECS.

Create a temporary directory backupdir.
mkdir backupdir

unzip files.
xbstream -x -p 4 <./ full backup file .qp -C ./backupdir/

innobackupex --parallel 4 --decompress ./backupdir

find ./backupdir/ -name '*.qp' | xargs rm -f

 

Application log.

innobackupex --apply-log ./backupdir

 

Backup data.

Stop the MySQL database services.
service mysql stop

Note:
If MySQL5.7, need to execute the following command to stop MySQL database service:

/bin/systemctl stop mysqld.service

Backup of the original database directory.
mv / var / lib / mysql / data / var / lib / mysql / data_bak

Create a new database directory and modify directory permissions.
mkdir / var / lib / mysql / data

chown mysql:mysql /var/lib/mysql/data

 

Full backup copies of files, and change the directory permissions.

innobackupex --defaults-file=/etc/my.cnf --copy-back ./backupdir

chown -R mysql:mysql /var/lib/mysql/data

 

Start the database.

service mysql start

Note:
If MySQL5.7, need to execute the following command to start the database:

/bin/systemctl start mysqld.service

 

Log database, view data recovery results.

mysql -u -root

show databases

Guess you like

Origin www.cnblogs.com/mingetty/p/12503388.html
Recommended