This topic describes how to download backups from ApsaraDB RDS for MySQL for scenarios such as long-term retention, backup queries, backup migration, and auditing.
Before you begin
No fees are charged for failed tasks.
You cannot cancel a backup download task after it starts.
You cannot use downloaded backup data to directly restore an RDS instance. To restore an instance, see Overview of data restoration solutions.
Directly downloading a backup is not always the best option. Before you start, identify your instance type and scenario to choose the most efficient and cost-effective method.
Billing details
You may be charged for outbound network traffic when you download backups from an instance that uses high-performance local disks. For instances that use cloud disks, you may be charged for both outbound network traffic and backup set conversion.
If you download backups to OSS, you are charged based on your actual usage of OSS.
Network traffic fees
Internal network downloads: Free of charge.
External network downloads: Each instance receives a free quota of 500 GB per month. Usage beyond this quota is billed on a pay-as-you-go basis. You can view the downloaded traffic volume on the Basic Information page of the RDS instance. For more information about unit prices, see Network fees.
You can download backups over an internal network or the internet for instances that use cloud disks and instances that use high-performance local disks.
When you start a snapshot backup download for an instance that uses cloud disks, the system creates a data conversion task. You cannot obtain a download link while the task is in progress or has failed. No outbound network traffic fees are incurred during this period. After the task is successfully completed, you are charged for the actual traffic generated when you use the download link.
Physical backup downloads for instances that use high-performance local disks do not involve data conversion. You can obtain the download link directly. You are charged for the actual traffic generated when you use the link to download the backup.
To view the public network backup download volume, go to the RDS Instance List page, click the instance ID, and then view Backup Download Volume in the Instance Resources section on the Basic Information page.
We recommend that you purchase a subscription network plan to cover data transfer fees for downloading backups over the public network. The larger the network plan capacity, the higher the discount.
Backup set conversion fees
This fee applies when you use the advanced download feature for an instance that uses cloud disks to convert a snapshot backup into a CSV (without header), CSV with header, SQL, or Parquet file. No free quota is provided. The billing standards are as follows:
Region | Conversion fee (USD/GB) |
Public cloud | 0.03125 |
When you start a snapshot backup download for an instance that uses cloud disks, the system creates a data conversion task. No backup set conversion fees are charged if this task fails.
Cloud disk instance download
Instances that use cloud disks support advanced download tasks for a specific point in time or a specific backup set. You can convert snapshot backups into CSV, SQL, or Parquet format. You can also download the backup to a URL or save the backup file directly to an OSS bucket.
Prerequisites
Before you start, make sure that the instance meets all the following conditions.
Instance status: Running.
Storage class: ESSD or premium performance disk.
Database version: MySQL 8.0 or 5.7.
Region support: China (Chengdu), China (Shenzhen), China (Guangzhou), China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hangzhou), China (Shanghai), China (Hong Kong), Malaysia (Kuala Lumpur), Indonesia (Jakarta), Japan (Tokyo), Singapore, US (Silicon Valley), US (Virginia), and Germany (Frankfurt). This feature is being gradually rolled out to other regions. The regions displayed in the console are the ones that are supported.
Minor engine version: The minor engine version must be later than
20201031. If the minor engine version of your instance does not meet this requirement, you must upgrade the minor engine version.ImportantIf the Download Instance Backup button is unavailable even though the minor engine version meets the requirements, this may be because the database proxy is enabled. Some instances do not support this download feature due to hardware limitations. To resolve this issue, you must first disable the database proxy and then upgrade the minor engine version. After the issue is resolved, you can re-enable the proxy service as needed.
Backup encryption: Disabled. The advanced download feature is not supported for encrypted instances that use cloud disks.
Data archiving: Disabled. The advanced download feature is not supported for instances that use premium performance disks for which data archiving is enabled.
RAM permissions: The RAM user must have permissions to download backup files. For more information about how to grant permissions to a RAM user, see Grant permissions to a read-only RAM user to download backup files.
Feature limitations
Unsupported objects: The downloaded backup files do not include expression indexes, foreign keys, generated columns, hidden columns, views, functions, stored procedures, system variables, or triggers.
Unsupported databases: The download does not include system databases such as
information_schema,mysql,performance_schema,sys, or__recycle_bin__.Unsupported data types: The download task may fail if a table contains special data types such as
GEOMETRY, POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, or GEOMETRYCOLLECTION.Storage class restriction: If the download destination is OSS, the storage class of the target bucket must be Standard. If you want to save the backup to an OSS bucket that uses a storage class other than Standard, you can use one of the following methods:
Method 1: Download the backup to a bucket that uses the Standard storage class, and then transform the storage class.
Method 2: Download the backup to a local machine, and then upload it to the destination bucket.
Procedure
Navigate to the backup list
Go to the RDS instance list, select the region where the instance is located, and then click the instance ID.
In the navigation pane on the left, choose Backup and Restoration > Base Backup List.
Start the download task
Download a log backup: On the Log Backup tab, find the target log file and click Download in the Actions column to obtain the download link. The log backup feature must be enabled.
Download a data backup: On the Data Backup tab, find the target backup set and click Download Instance Backup in the Actions column.
Configure the parameters for the instance backup download
In the Download Time Point and Backup Set step, select Download by Backup Set or Download by Time Point, and then click Next.
In the Download Instance and Database/Table step, keep the default setting (Instance Download) and click Next.
In the Download Destination and Format step, configure the download destination and format.
Download Destination
Configuration
OSS (Recommended)
Enter the bucket name and directory prefix of the destination OSS.
Set Download Format to CSV (without header), CSV-with-header, SQL, or Parquet.
If this is your first time using this feature, click Go to Authorize > Agree to Authorization as prompted to grant RDS permissions to access OSS.
URL
Select URL.
Select the download format.
After the task is successful, you must manually generate a download link. The link is valid for a limited time.
Confirm and execute: Read and select the acknowledgment, and then click Finish. The page automatically redirects to the Backup Download List tab, where you can monitor the task status.
Obtain the backup file
OSS method: Wait for the task status to change to Successful. The file is automatically downloaded to the specified OSS bucket and directory.
URL method: Wait for the task status to change to Successful. Within the validity period of 3 days, click Generate Link in the Download Destination column. Set the link validity period, which can be from 5 minutes to 1 day and is 2 hours by default, to obtain the internal or external download URL. After the task and the link expire, the temporary data is automatically deleted. You must start a new download task if the link expires.
ImportantThe conversion process competes for computing resources on the service side. The download may fail due to temporary resource allocation failures or unsupported data formats. If a task fails, try to download the backup again.
Use a command-line tool to download the file
After you obtain the URL download link:
Use a command-line tool such as wget or curl to download the file. This is the recommended method. For more information, see Appendix 1: Download commands.
If the file is small, you can copy the external URL to your browser's address bar.
Download backups from an instance that uses high-performance local disks
The process for downloading backups from an instance that uses high-performance local disks is more direct. This process does not require data format conversion, and you can immediately obtain the download link for a physical backup or a log backup.
Prerequisites
Before you start, make sure that the instance meets all the following conditions.
Storage class: High-performance local disk.
RAM permissions: The RAM user must have permissions to download backup files. For more information about how to grant permissions to a RAM user, see Grant permissions to a read-only RAM user to download backup files.
Procedure
Navigate to the backup list
Go to the RDS instance list, select the region where the instance is located, and then click the instance ID.
In the navigation pane on the left, choose Backup and Restoration > Base Backup List.
Obtain the download link
Select the Data Backup or Log Backup tab.
Find the target backup file and click Download Instance Backup (for a data backup) or Download (for a log backup) in the Actions column.
In the dialog box that appears, you can directly copy the internal URL or the external URL.
Internal URL: This is the recommended method. You must download the backup from an Alibaba Cloud ECS instance that is in the same region and VPC. This method is fast and free of charge. Cross-region downloads over the internal network are not supported.
External URL: Use this to download from a local machine or another network environment.
Use a command-line tool to download the file
After you obtain the URL download link:
Use a command-line tool such as wget or curl to download the file. This is the recommended method. For more information, see Appendix 1: Download commands.
If the file is small, you can copy the external URL to your browser's address bar.
The backup download link is valid for 1 hour. Download the file promptly to prevent the link from expiring. If the link expires, you must start a new download task to obtain a new link. A download task that has already started is not affected by the link's validity period.
Log backup refers to the backup of local logs. To obtain local logs, see mysqlbinlog.
If an instance is a High-availability Edition or a three-node edition, both the primary and secondary instances generate log backups. You can view the IDs of the primary and secondary instances on the Service Availability page.
If you want to restore data to a self-managed database, the point in time of the data backup must be within the time range of the log backup. The log backup and data backup must belong to the same instance. This means they must have the same instance ID.
Appendix 1: Download commands
After you obtain the URL download link, we recommend that you use a command-line tool such as wget or curl to download the file. These tools support resumable downloads and help ensure stability.
If the network download speed is too low (less than 64 KB/s), the download may be interrupted. Make sure you have a stable network connection during the download.
If you download a backup set to an ossfs-mounted disk, you may need to adjust the multipart_size parameter. By default, this parameter supports a maximum file size of 100 GB. If a backup set is larger than 100 GB, the download fails. For more information about ossfs and its configuration, see ossfs and Mounting options.
We recommend that you use the wget or curl commands provided in this topic to download backup sets. If you use other third-party tools, the file may be downloaded repeatedly (the actual downloaded data size is larger than the backup set size). This will incur extra fees for the outbound traffic that exceeds the backup set size.
wget
nohup wget -c -t 0 "Backup file download URL" -O Path and filename to save the downloaded file > Download process monitoring log &Parameters:
Parameter | Description |
nohup | Prevents the download from being interrupted if the terminal disconnects or if you accidentally perform a copy operation. The process automatically exits after the download is complete. |
-t | Number of retries. Set to 0 for infinite retries. |
-c | Supports resumable downloads. |
-O | The path and filename to save the downloaded file. |
Example:
nohup wget -c -t 0 "https://dbs-****.aliyundoc.com/****.tar.gz****" -O /backup/examplebackup.tar.gz > /tmp/download.log &curl
nohup curl -C - --retry 10 "Backup file download URL" -o Path and filename to save the downloaded file > Download process monitoring log &Parameters:
Parameter | Description |
nohup | Prevents the download from being interrupted if the terminal disconnects or if you accidentally perform a copy operation. The process automatically exits after the download is complete. |
--retry | Number of retries if the task fails. Set to 10 to retry 10 times. |
-C - | Supports automatic resumable downloads. |
-o | The path and filename to save the downloaded file. |
Example:
nohup curl -C - --retry 10 "https://dbs-****.aliyundoc.com/****.tar.gz****" -o examplebackup.tar.gz > /tmp/download.log &Appendix 2: Scenarios
Scenario and purpose | Recommendation |
| Choose one of the following methods:
|
| Choose one of the following methods:
|
| Choose one of the following methods:
|
Upload a backup to OSS | RDS backups are stored in backup storage and do not occupy instance storage space. To store backups in OSS, you can choose one of the following methods:
|
Retain backups long-term |
|
Automatically download backups | |
Download binary logs |
|
References
After you use the backup download feature to convert and export snapshot backup data from an instance that uses cloud disks to a CSV or SQL file, you can use the file to restore the ApsaraDB RDS for MySQL snapshot backup to a self-managed database.
To perform query analysis on the data of an ApsaraDB RDS for MySQL instance that uses cloud disks, you can use the advanced download feature to download the data directly to Alibaba Cloud OSS. Then, you can import the data from OSS to AnalyticDB for MySQL (ADB) for query analysis. For more information, see Import backup data from an instance that uses cloud disks to AnalyticDB for MySQL.
You can use the backup download feature and the mysqldump tool to restore RDS MySQL logical backup files to a self-managed database on a high-performance local disk instance.
You can use the backup download feature for an instance that uses high-performance local disks to restore an ApsaraDB RDS for MySQL physical backup file to a self-managed database.
You can also use API operations to download backups. The following API operations are available:
CreateDownload - Create a download task (for instances that use cloud disks)
DescribeDownloadTask - Query the list of download tasks (for instances that use cloud disks)
DescribeBackups - View the list of backup sets for an RDS instance
DescribeBinlogFiles - View the binary log files of an RDS instance
To download backups for other database engines, see the following topics:
FAQ
For more information about downloading backups, see FAQ about backup downloads.