Help Center/ GaussDB(for MySQL)/ FAQs/ Log Management/ How Do I Change the Binlog Retention Period?
Updated on 2024-09-05 GMT+08:00

How Do I Change the Binlog Retention Period?

GaussDB(for MySQL) is compatible with the binlog_expire_logs_seconds parameter of community version 8.0. You can change binlog retention period using this parameter.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and project.
  3. Click in the upper left corner of the page, choose Databases > GaussDB(for MySQL).
  4. On the Instances page, click the instance name.
  5. In the navigation pane, choose Parameters. On the Parameters tab, view the following parameters.

    • If the kernel version is earlier than 2.0.45.230900, search for the log-bin parameter. If the parameter value is ON, binlog is enabled.
    • If the kernel version is 2.0.45.230900 or later, search for the rds_global_sql_log_bin parameter. If the parameter value is ON, binlog is enabled.
    To view the kernel version, click the instance name to go to the Basic Information page. In the DB Instance Information area, view the Kernel Version field.
    Figure 1 Viewing the kernel version

  6. On the Parameters tab, configure binlog_expire_logs_seconds.

    • When a new binlog file is generated, any existing binlog files that have expired will be deleted.
    • If no new binlog file is generated, historical binlog files will not be deleted even if they have expired. To delete binlog files manually, connect to the database and run flush logs; to forcibly generate a new binlog file.