Purge binlog files
You can purge specified binlog files. For more information, see PURGE BINARY LOGS Statement.
Syntax
Purge binlog files of the specified tenant
PURGE BINARY LOGS { TO 'log_name' FOR TENANT cluster.tenant | BEFORE datetime_expr FOR TENANT cluster.tenant };Purge binlog files of the specified instance
PURGE BINARY LOGS { TO 'log_name' FOR INSTANCE instance_name | BEFORE datetime_expr FOR INSTANCE instance_name };
Parameters
| Parameter | Description |
|---|---|
| log_name | The name of the binlog file to be purged. You can configure this parameter to purge the specified binlog file from the specified tenant or instance. |
| cluster.tenant | The name of the tenant whose binlog files are to be purged, and the name of the cluster to which the tenant belongs. |
| datetime_expr | The cutoff timestamp for purging binlog files. Binlog files generated before this timestamp in the specified tenant or instance will be purged. The value is in the YYYY-MM-DD hh:mm:ss format. |
| instance_name | The name of the instance whose binlog files are to be purged. |
Examples
Purge the
mysql-bin.000001file from thetest1tenant of theobdemocluster.PURGE BINARY LOGS TO 'mysql-bin.000001' FOR TENANT obdemo.test1;Purge the binlog files that are generated after
2024-11-20 11:30:30in thebinlog1instance.PURGE BINARY LOGS BEFORE '2024-11-20 11:30:30' FOR INSTANCE binlog1;