To save storage capacity, physical and logical backups in TencentDB for MySQL will be compressed with qpress and then packed with xbstream offered by Percona.
The open-source Percona XtraBackup can be used to back up and restore databases. This document describes how to use XtraBackup to restore a logical backup file of TencentDB for MySQL instance to a self-built database on CVM.
wgetcommand for download over the private network at a higher speed.
- You can also click Download to download it directly, which may take longer.
wgetcommand format: wget -c 'backup file download address' -O custom filename.xb
wget -c 'https://mysql-database-backup-bj-118.cos.ap-beijing.myqcloud.com/12427%2Fmysql%2F42d-11ea-b887-6c0b82b%2Fdata%2Fautomatic-delete%2F2019-11-28%2Fautomatic%2Fxtrabackup%2Fbk_204_10385%2Fcdb-1pe7bexs_backup_20191128044644.xb?sign=q-sign-algorithm%3Dsha1%26q-ak%3D1%26q-sign-time%3D1574269%3B1575417469%26q-key-time%3D1575374269%3B1517469%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3Dfb8fad13c4ed&response-content-disposition=attachment%3Bfilename%3D%2141731_backup_20191128044644.xb%22&response-content-type=application%2Foctet-stream' -O test0.xb
Unpack the backup file with xbstream.
xbstream -x < test0.xb
test0.xbwith your backup file.
The unpacking result is as shown below:
If an error is displayed during the
wgetdownload, you can go to QuickLZ's official website to download qpress locally and upload it to the Linux CVM instance. For more information, please see Upload Files via SCP.
tar -xf qpress-11-linux-x64.tar -C /usr/local/bin source /etc/profile
qpress -d cdb-jp0zua5k_backup_20191202182218.sql.qp .
The decompressing result is as shown below:
Find the backup file with
.sql.qpextension by decompression time and replace
cdb-jp0zua5k_backup_20191202182218with its filename.
Import the .sql file into the target database by running the following command:
mysql -uroot -P3306 -h127.0.0.1 -p < cdb-jp0zua5k_backup_20191202182218.sql
- This document takes importing into a local MySQL instance with port 3306 as an example. You can replace it as needed.
cdb-jp0zua5k_backup_20191202182218.sqlwith the .sql file extracted by qpress.