This topic describes how to enable binlogging feature for PolarDB for MySQL cluster.
The space used to store binlogs is a part of the cluster storage space. It is charged based on the pricing policies.
- By default, the binlog files are saved for two weeks after binary logging is enabled. The binlog files that are generated more than two weeks ago are automatically deleted. For more information, see FAQs.
- By default, the binlogging feature is disabled. To enable this feature, you need to restart the instance, which will cause service interruptions. We recommend that you arrange services appropriately before you restart an instance.
- After binlogging is enabled, the write performance is deteriorated, while the read performance is not affected. For more information, see FAQs.
- The primary endpoint directly points to the primary node that generates binlog files, ensuring higher compatibility and stability. We recommend that you use the Primary Endpoints of ApsaraDB for PolarDB when you pull, subscribe to, or synchronize binlog files by using a tool such as DTS. For how to check the Primary Endpoints, see View endpoints.
- Log on to the Apsara PolarDB console.
- On the top of the page, select the region where the target cluster is located.
- Find the target cluster and click the cluster ID to go to the Overview page.
- In the left-side navigation pane, choose .
- Search for the loose_polar_log_bin, change the value on the Current Value dialog box, and then click Apply Changes.Note
- For PolarDB for MSQL 5.6, you need change the Current Value to ON_WITH_GTID.
- For PolarDB for MSQL 8.0, you need change the Current Value to ON.
- In the Save Changes dialog box that appears, click OK
- Q: How long can binlog files be stored?
A: By default, the binlog files are saved for two weeks after binlogging is enabled. The binlog files that are generated more than two weeks ago are automatically deleted.
- For PolarDB for MySQL 5.6, you can modify the loose_expire_logs_hours parameter to set the duration for storing binlog files. The value ranges from 0 to 2376 hours. The value 0 indicates that the binlog files are not automatically deleted.
- For PolarDB for MySQL 8.0, you can modify the binlog_expire_logs_seconds parameter to set the duration for storing binlog files. The value ranges from 0 to 4294967295 seconds. The value 0 indicates that the binlog files are not automatically deleted.
- Q: How do I disable binlogging after it is enabled?
A: Set the loose_polar_log_bin parameter to OFF, and then submit the changes. The existing binlog files will not be deleted after binlogging is disabled.
- Q: After binlogging is enabled, will the service performance be compromised?
A: The binlogging feature does not affect the performance of processing read statements such as SELECT. However, this feature may reduce the performance of processing write statements such as INSERT, UPDATE, and DELETE. In most cases, if you enable this feature, the service performance may be reduced by up to 10%.