This topic describes how to enable binlogging feature for PolarDB for MySQL cluster.

Prerequisites

The cluster was created after April 5, 2019. If the cluster was created on April 5, 2019 or earlier, you need to open a ticket to perform minor version upgrade. After that, you can enable binlogging in the console.

Background information

ApsaraDB for PolarDB is a cloud native database fully compatible with MySQL. By default, it uses more advanced physical logs instead of binlogs. However, to better integrate with the MySQL ecosystem, ApsaraDB for PolarDB allows you to enable binlogging. When binlogging is enabled, you can connect to the data products such as ElasticSearch and AnalyticDB. You can also synchronize data from PolarDB to RDS, from RDS to PolarDB, or between PolarDB clusters in a real time manner.

Pricing

The space used to store binlogs is a part of the cluster storage space. It is charged based on the pricing policies.

Precautions

  • 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 or apply for an endpoint .

Enable binlogging

  1. Log on to the PolarDB console.
  2. On the top of the page, select the region where the target cluster is located.
  3. Find the target cluster and click the cluster ID to go to the Overview page.
  4. In the left-side navigation pane, choose Settings and Management > Parameters.
  5. Search for the loose_polar_log_bin, change the value on the Current Value dialog box, and then click Apply Changes.
    1
    Note
    • For PolarDB for MySQL 5.6, you need change the Current Value to ON_WITH_GTID.
    • For PolarDB for MySQL 5.7 or 8.0, you need change the Current Value to ON.
  6. In the Save Changes dialog box that appears, click OK
    Note If the error message Custins minor version does not support current action is displayed, open a ticket to enable binlogging.

FAQs

  • 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 5.7 or 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%.