Setting a Local Retention Period for RDS for MySQL Binlogs
Scenarios
RDS for MySQL lets you define how long local binlogs are kept. Once an incremental backup is complete, all local binlogs will be deleted. Adjust the binlog retention period as needed.
Constraints
- Binary logging is enabled for RDS by default and uses row-based logging.
- On the RDS console, you can set the binlog retention period only for the primary instance. The binlog retention period for read replicas is the same as that of the primary instance.
- If there are abnormal read replicas or standby instances, local binlogs will not be cleaned up. This prevents replication failures on the read replicas or standby instances.
- 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.
- The binlog retention period is measured in hours on the console. However, the values of expire_logs_days (MySQL 5.7) and binlog_expire_logs_seconds (MySQL 8.0) are measured in days when you query the binlog retention period by running a command, which cannot be used as a reference. To see how long the binlogs can be retained, check the binlog retention period on the console.
Differences Between Local Binlogs and Binlog Backups
| Item | Local Binlogs | Binlog Backups |
|---|---|---|
| Overview | Local binlogs are used to set up a primary/standby architecture and subscribe to data. | RDS automatically backs up data updated since the last incremental backup every 5 minutes. You can use binlog backups to restore instance data to a point in time. |
| Status | This function is enabled by default and cannot be disabled. The default retention period is 0, which means that local binlogs will be deleted upon being backed up. For details about how to customize the retention period, see Procedure. | This function is enabled by default and cannot be disabled. |
| Storage space | Local binlogs occupy the storage space of your instance. | Binlog backups do not occupy the storage space of your instance. Backups are automatically stored in OBS buckets as packages. They occupy the OBS backup space. To query data in a backup, see Downloading a Binlog Backup File. |
Procedure
- Log in to the management console.
- Click
in the upper left corner and select a region and a project. - Click
in the upper left corner of the page and choose Database > Relational Database Service. - On the Instances page, click the target DB instance to go to the Basic Information page.
- In the navigation pane on the left, choose Backups & Restorations. On the Binlog Backups page, click Set Binlog Retention Period.
- In the displayed dialog box, set the local retention period and click OK.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot