Help Center> Relational Database Service> User Guide> Working with RDS for MySQL> Data Backups> Setting a Local Retention Period for RDS for MySQL Binlogs
Updated on 2024-04-19 GMT+08:00

Setting a Local Retention Period for RDS for MySQL Binlogs

Scenarios

RDS for MySQL deletes local binlogs after they are backed up to OBS. You can set the local retention period for binlogs as required.

Binary logging is enabled for RDS by default and uses row-based logging.

Read replicas do not have backups and do not generate binlogs.

Binlogs can be retained from 0 to 168 (7x24) hours locally.

If the retention period is set to 0, the binlogs of your DB instance will be deleted once they are synchronized to the standby instance and read replicas and successfully backed up to OBS. If the retention period is set to a value greater than 0, for example, 1 day, the binlogs will be retained for one day after they are synchronized to the standby instance and read replicas from the primary instance and successfully backed up to OBS. After the retention period expires, the binlogs will be automatically deleted. For details about how to view binlogs, see Downloading a Binlog Backup File.

Precautions

The binlog retention period is displayed in hour on the console. However, the value of expire_logs_days is displayed in day when you query the binlog retention period by running a command, which cannot be used as a reference. To check how long the binlogs can be retained, view the binlog retention period on the console.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and a project.
  3. Click in the upper left corner of the page and choose Databases > Relational Database Service.
  4. On the Instances page, click the target DB instance.
  5. In the navigation pane on the left, choose Backups & Restorations. On the Binlog Backups page, click Set Binlog Retention Period.
  6. In the displayed dialog box, set the local retention period and click OK.

    Figure 1 Setting the binlog retention period

    When binlogs are deleted depends on the local retention period you configure on the console.