This topic describes how to configure a policy that allows an ApsaraDB RDS for MySQL instance to automatically upload its binary log files to an Object Storage Service (OSS) bucket. This topic also describes how to manually upload these binary log files. The operations in this topic allow you to reduce the storage usage of your RDS instance.
Background information
Before you upload the binary log files of your RDS instance to an OSS bucket, you must understand the rules based on which MySQL generates and deletes binary log files.
- Default rules based on which MySQL generates binary log files
- In most cases, when the size of a binary log file reaches 500 MB, your RDS instance starts to write data into a new binary log file. This indicates that the size of every binary log file is 500 MB.
- Your RDS instance may stop writing data into a binary log file before the size of the file reaches 500 MB. For example, this can occur due to some commands or a restart.
- Your RDS instance may continue writing data into a binary log file even after the size of the file reaches 500 MB. For example, this can occur due to large transactions.
- Default rules based on which MySQL deletes binary log files
If one or more of the following rules are triggered, your RDS instance starts to upload binary log files to the specified OSS bucket. Then, your RDS instance starts to delete binary log files. The deletion process starts from the earliest binary log file. When no rules are triggered, the deletion process is stopped. Binary log files are uploaded by using tasks. These tasks are scheduled in Data Transmission Service (DTS) based on specified rules. In addition, these tasks are executed at specific latencies.
- Your RDS instance can store only the binary log files that are generated over the last 18 hours.
- Your RDS instance can store a maximum of 60 binary log files.
- The storage space that is occupied by the binary log files on your RDS instance cannot exceed 30% of the purchased storage capacity.
- The storage usage of your RDS instance cannot exceed 80%, or the remaining storage space cannot be less than 5 GB.
Note If one or more of the preceding rules are triggered but your RDS instance does not upload or delete binary log files, your database client may encounter errors. This may also occur if the tasks that are scheduled in DTS to upload binary log files are blocked. In these cases, you must terminate the blocked tasks. You can view the IDs of the threads that are used to run the tasks. The IDs of the threads are provided on the Error Logs tab of the Logs page in the ApsaraDB RDS console.[Warning] file /home/mysql/data3001/mysql/mysql-bin.069435 was not purged because it was being readby thread number 17126285
Configure a policy that is used to upload binary log files
Upload binary log files
You can manually upload the binary log files of your RDS instance. Your RDS instance deletes all the binary log files that are uploaded to the specified OSS bucket. Binary log files are uploaded by using tasks. These tasks are scheduled in DTS based on specified rules. In addition, these tasks are executed at specific latencies.
- Go to the Backup and Restoration page.
- Click Upload Binlogs. In the message that appears, click OK.
Related operations
Operation | Description |
---|---|
PurgeDBInstanceLog | Deletes or compresses the binary log files of an ApsaraDB RDS instance. |