This topic describes how to configure local binary log policies for an RDS for MySQL instance. RDS for MySQL deletes local binary log files according to the polices you specify. Before you set the policies, you must learn about the rules for MySQL to generate and delete binary log files.

Background information

For information about the related API, see DescribeBinlogFiles.

The rules for an RDS for MySQL instance to generate binary log files are as follows:

  • In typical cases, when the size of the current binary log file exceeds 500 MB, the system starts to write data into a new binary log file. When the system is writing data into the new file, the old file is uploaded asynchronously.
  • In certain circumstances, the system stops writing data into the current binary log file due to reasons such as command execution and system restart even when the file size does not exceed 500 MB.
  • In certain circumstances, the size of a binary log file exceeds 500 MB when, for example, the system is executing a large transaction.

The default rules for an RDS for MySQL instance to delete binary log files are as follows:

  • By default, the system retains the binary log files generated within the last 18 hours.
  • When the space usage does not exceed 80%, the system retains the binary log files that occupy 30% of the space regardless of whether these files have been uploaded to OSS or not.
  • When the space usage exceeds 80%, the system initiates requests for deleting local binary log files after these files are uploaded to OSS. The requests must be scheduled, and therefore these files are deleted at a certain delay.

Procedure

  1. Log on to the RDS console.
  2. In the upper-left corner, select the region where the target RDS instance is located.
    选择地域
  3. In the left-side navigation pane, click Backup and Restoration.
  4. Click the Local Log Settings tab and in the Local Binary Log Settings section view the local log settings of the RDS instance.

    本地Binlog设置
  5. Click Edit.

    本地Binlog设置
  6. In the Local Binary Log Settings dialog box, set Retention Period, Max Space Usage, and Protection Available Space
    Parameter description:
    • Retention Period: The period for retaining each generated binary log file. After the retention period elapses, the system deletes the binary log file after backing up it. Note that the system backs up binary log files only after you enable the log backup function. Value range: 0 - 7*24. Default value: 18. Unit: hour.
    • Max Space Usage: The maximum space usage that is allowed for local binary log files. When the space occupied by local binary log files exceeds the maximum usage, the system starts to delete earlier local binary log files. The system stops deleting local binary log files until the space usage drops below the maximum usage. Value range: 0 - 50%. Default value: 30%.
    • Protection Available Space: Indicates whether the system deletes earlier local binary log files when the total space usage of the RDS instance exceeds 80% or the remaining space is less than 5 GB. The system stops deleting local binary log files when the total space usage drops below 80% and the remaining space is greater than 5 GB. Default value: Enable.
  7. After you set the parameters, click OK.