This document describes how to restore data from a logical backup file.
Overview
Note:
To save storage space, TDSQL-C for MySQL backup files will be compressed with qpress and then packed with xbstream offered by Percona.
If the used storage space of your cluster exceeds 2 TB, it is not recommended to use logical backups, otherwise a risk of backup failure may exist.
TDSQL-C MySQL Edition supports logical backup methods, allowing users to manually generate logical backup files through the console. It also supports the download and acquisition of logical backup files for the entire cluster or partial databases. This document introduces data recovery using logical backup files on the Linux platform.
Directions
Step 1. Downloading the Backup File
In the cluster list on the left, click Target Cluster to enter the cluster management page.
Locate the target cluster in the list on the left, and click the Cluster ID or Manage in the Operation column to access the cluster management page.
2. On the cluster management page, select Backup Management > Data Backup List, find the target backup, and click Download in the Operation column.
3. Copy the download address in the pop-up window, log in to a Linux CVM instance as instructed in Customizing Linux CVM Configurations, and run the wget
command for fast download. Note:
If the cluster and CVM instance are in the same region, the wget
command can be used for fast download over the private network, no matter whether they are in the same or different VPCs.
If the cluster and CVM instance are in different regions, fast download over the private network is not supported, and the public IP must be enabled for the CVM instance before the wget
command can be used for download.
You can also click Download to download it directly. However, this may take a longer time.
The wget
command format is as follows:
wget -c "<backup download address>" -O <custom filename>.xb
Step 2. Unpacking the Backup File
Unpack the backup file with xbstream.
xbstream -x < test0.xb -P
Note:
Replace test0.xb
with your backup file name.
The unpacking result is as shown below:
Step 3. Decompressing the Backup File
1. Download qpress by running the following command.
wget -d --user-agent="Mozilla/5.0 (Windows NT x.y; rv:10.0) Gecko/20100101 Firefox/10.0" https://docs-tencentdb-1256569818.cos.ap-guangzhou.myqcloud.com/qpress-11-linux-x64.tar
2. Extract the qpress binary files by running the following command:
tar -xf qpress-11-linux-x64.tar -C /usr/local/bin
source /etc/profile
3. Decompress the backup file with qpress.
qpress -d <backup file> <unzipped file>
<Backup file>: Replace with the corresponding unpacked backup filename. The angle brackets <> in the command should be removed, retaining only the actual parameters.
<Unzipped file>: Specify the custom filename after decompression, which should immediately follow the backup file name in the command. The angle brackets <> in the command should be removed.
Step 4. Importing the Backup File into the Target Database
Import the .sql file into the target database by running the following command:
mysql -u<account name> -P<port> -h<target database's private network address> -p < <.sql file compressed with qpress>
Was this page helpful?