This topic describes how to download the backup files of an ApsaraDB RDS for MySQL instance.
For more information about how to download the backup files of an RDS instance that runs a different database engine, see the following topics:
Before you begin
Before you download the backup files of your RDS instance, you must select a download method based on your business scenario.Business scenario | Recommended download method |
---|---|
|
Use one of the following methods:
|
|
Use one of the following methods:
|
|
For more information, see Perform an advanced download |
|
Use one of the following methods:
|
|
Backup files do not consume the storage capacity of your RDS instance. Backup files
are stored in the provisioned backup storage and cannot be moved. Use one of the following
methods to store a backup file of your RDS instance to an OSS bucket:
|
|
|
|
|
Backup storage fee
- ApsaraDB RDS provides a free quota for backup downloads over the Internet. Starting
from 00:00 on November 25, 2021, you are charged for the excess traffic that you consume
to download backup files over the Internet. For more information,see [Notice] Upgrade and commercial release of the backup download feature.
- Downloads over an internal network: You are not charged for the traffic that you consume.
- Downloads over the Internet: After the free quota is exhausted, you are charged a daily fee for the excess traffic that you consume. For more information, see Billing overview.
- Free quota for backup downloads over the Internet: The free quota for each RDS instance is 500 GB per month.
- You are charged if you convert the backup files of your RDS instances. This applies only when you perform advanced downloads. The advanced download feature is in public preview. In the public preview phase, advanced downloads are free of charge.
To view the volume of traffic that you consumed to download backup files over the Internet, you can log on to the ApsaraDB RDS console, find your RDS instance, go to the Basic Information page, and then view the Backup Downloads parameter in the Usage Statistics section of the page.
Perform an advanced download
You can convert a backup file of your RDS instance into a CSV file and download the file to an on-premises device. This process is called advanced download. If you want to analyze data or archive data to an on-premises device, you can perform advanced downloads.
- Your RDS instance runs one of the following MySQL versions:
- MySQL 8.0 with standard SSDs or enhanced SSDs (ESSDs)
- MySQL 5.7 with standard SSDs or ESSDs
- Your RDS instance resides in one of the following regions: China (Zhangjiakou), China
(Guangzhou), China (Beijing), China (Shanghai), China (Hangzhou), and China (Shenzhen).
Note The feature will be available in the other regions soon.
- The minor engine version of your RDS instance must be a later version than 20201031. For more information, see Update the minor engine version of an ApsaraDB RDS for MySQL instance.
- The disk encryption feature is not enabled for your RDS instance. RDS instances for which disk encryption is enabled do not support advanced downloads.
- The Resource Access Management (RAM) user that you want to use to log on to your RDS instance is granted the permissions to download backup files. For more information about how to grant permissions to a RAM user, see Grant backup file download permissions to a RAM user with read-only permissions.
Limits
- The advanced download feature allows you to export most schemas. Some schemas cannot
be exported.
- You can export column information, primary key indexes, non-primary key indexes, unique indexes, partition table information, table engines, and table-level or database-level character sets and character collations.
- You cannot export expression indexes, foreign keys, generated columns, hidden columns, views, functions, stored procedures, system variables, or triggers.
- The advanced download feature does not support fields of spatial data types. If your
RDS instance contains fields of the following spatial data types, file conversions
fail:
GEOMETRY, POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, and GEOMETRYCOLLECTION
- The CSV files that you export from your RDS instance do not contain the following
system libraries:
information_schema
,mysql
,performance_schema
,sys
, and__recycle_bin__
Procedure
Perform a regular download
Prerequisites
- Your RDS instance uses local SSDs.
- The RAM user that you want to use to log on to your RDS instance is granted the permissions to download backup files. For more information about how to grant permissions to a RAM user, see Grant backup file download permissions to a RAM user with read-only permissions.
Procedure
Appendix: Download commands
This section describes the commands that are commonly used to download backup files.
- If the speed of a download is lower than 64 KB per second, the download may be interrupted. When you download a backup file, we recommend that you ensure optimal network status.
- If you want to download a backup file to a disk that is attached by using the ossfs plug-in, you must adjust the value of the multipart_size parameter for the ossfs plug-in. The maximum value of this parameter is 100 GB. If the size of the data backup file that you want to download exceeds 100 GB, the download fails. For more information about the ossfs plug-in and its parameter settings, see Overview and Common options.
- We recommend that you use the commands, such as wget and curl, that are provided in this topic to download a data backup file. If you use third-party tools to download a data backup file, the data backup file may be downloaded multiple times. As a result, the amount of data that is downloaded is greater than the size of the data backup file, and you may be charged for the traffic that is consumed to download the excess amount of data over the Internet.
Command: nohup wget -c -t 0 "The URL that is used to download the backup file" -O The save path and name of the downloaded backup file> The file to which the downloaded data is saved &
Example: nohup wget -c -t 0 "https://example.aliyundoc.com/examplebackup.qp.xb" -O /backup/examplebackup.qp.xb > /tmp/download.log &
The following information provides the meanings of the options in the preceding command:
- -t 0: enables an unlimited number of retries.
- -c: enables resumable uploads.
- -O: specifies the save path and file name of the backup file after the backup file is downloaded.
- nohup: prevents interruptions to the download and specifies that the process automatically exits after the download is complete. If you accidentally replicate data or disconnect your database client during the download, the download is interrupted.
Command: nohup curl -C - --retry 10 "The URL that is used to download the backup file" -o The user-defined name of the downloaded backup file> The file to which the downloaded data is saved &
Example: nohup curl -C --retry 10 "https://example.aliyundoc.com/examplebackup.qp.xb" -o backup.qp.xb > /tmp/download.log &
The following information provides the meanings of the options in the preceding command:
- --retry 10: enables up to 10 retries if the download fails.
- -C -: enables resumable uploads.
- -o: specifies the save path and file name of the backup file after the backup file is downloaded.
- nohup: prevents interruptions to the download and specifies that the process automatically exits after the download is complete. If you accidentally replicate data or disconnect your database client during the download, the download is interrupted.
FAQ
How do I use the data backup files and log backup files that I downloaded?You can restore the data of the backup files that you downloaded by using the advanced download feature to self-managed MySQL instances. For more information, see Restore the data of an ApsaraDB RDS for MySQL instance from a physical backup file to a self-managed MySQL database or Restore the data of an ApsaraDB RDS for MySQL instance from a logical backup file to a self-managed MySQL instance.
My RDS instance runs standard SSDs or ESSDs. What do I do if the "ERROR 1148 (42000): The used command is not allowed with this MySQL version
" error message appears when I restore the data of a backup file that I downloaded
by using the advanced download feature to a self-managed MySQL instance?
Run the show variables like 'local_infile';
command on the self-managed MySQL instance. If the output is OFF, execute the SET
statement to set the global local_infile
parameter to 1 to enable file import. After the preceding operations are complete,
run the import script again.
Related operations
Operation | Description |
---|---|
DescribeBackups | Queries the data backup files of an ApsaraDB RDS instance. |
DescribeBinlogFiles | Queries the log backup files of an ApsaraDB RDS instance. |