tencent cloud


Configuring Local Binlog Retention Policy

Last updated: 2021-08-04 15:59:04

    This document describes how to set the binlog retention period for a TencentDB for MySQL instance in the console.

    Binlog Description

    Binlog grows fast when a TencentDB for MySQL instance executes large transactions or lots of DML operations. Binlog is split every 256 MB and uploaded to COS. You can see the uploaded binlog files in the log list in the console.


    Before being uploaded to COS, binlog files are stored on the instance disk (i.e., locally). You can set the local binlog retention period, control the maximum percentage of disk space binlog can take up, or expand disk space in the console. We recommend you clear data no longer used to keep the disk utilization below 80%.

    • MySQL's data sync is based on binlog. To ensure database restorability, stability, and high availability, binlog cannot be disabled in TencentDB for MySQL.
    • The generated binlog files are automatically backed up to COS through the automatic backup feature provided by TencentDB for MySQL. The binlog files whose backups are already uploaded to COS will be cleared according the local binlog retention policy. To prevent exceptions, the binlog files in use cannot be cleared even they expire. Therefore, the local binlog clearing has a delay.

      Rule for clearing expired binlog files:
      The local binlog files are checked once every 60 seconds. If a binlog file's start time or space usage does not meet the set retention rule, it will be added to the queue of to-be-deleted files. The binlog files in the queue will be sorted by time and deleted starting from the oldest file one by one until the queue is cleared.


    1. Log in to the TencentDB for MySQL console and click an instance ID in the instance list to enter the instance management page.
    2. On the instance management page, select the Backup and Restoration tab and click Configure Local Binlog.
    3. In the pop-up window, specify the retention period and space utilization threshold and click OK.


    Will database restoration be affected if the local binlog retention period is too short?

    No, because the generated binlog files will be uploaded to COS through the automatic backup feature as soon as possible, and those not uploaded yet cannot be cleared. However, too short a retention period will affect the speed of rollback.

    What is the default retention policy for local binlog?

    By default, the local binlog retention period is 120 hours, and the maximum binlog space utilization is 30%.

    Will binlog files take up the instance disk space?

    Yes. Before the binlog files are uploaded to COS and cleared according to the retention policy, they will be stored on the instance disk.

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support