MySQL Blog Archive
For the latest blogs go to blogs.oracle.com/mysql
MySQL 8.0.3: Binary logging and Replication chains are now enabled by default

MySQL 8.0.3 release candidate is out with amazing new replication features, along with changes in couple of replication default options. Thanks to our users for their constant feedback and valuable inputs, MySQL is changing defaults whenever possible to remove configuration overhead for practical deployment of MySQL server. One such long-awaited requirement from the users was to have server in get-go state for replication. So, finally here it is in MySQL 8.0.3.

Introduction

We can broadly categorize use-cases of MySQL server in following three categories as per usage of binary logs:

  1. UseCase#1: Replicate (Use binary log, and do replicate).
    It is useful for most of the production installations, since it is the base for implementing HA and Scalability.
  2. UseCase#2: Use binary log, but do not replicate.
    It is useful on smaller deployments where the binary log can be used for debugging or point-in-time recovery.
  3. UseCase#3: Do not use binary log, and do not replicate.
    It is useful for smaller deployments that need to save space.

Traditionally, MySQL provided UseCase#3 by default. Our long-term goal is to tweak the defaults so that UseCase#1 becomes the no-config mode, because the demand for HA and scalability are high nowadays. In 8.0.3, for the first time, the defaults are set for use case UseCase#2: the binary logging is now enabled! This also removes configuration steps for UseCase#1, and we further removed configuration steps for chained replicationSo we made a big step forward towards the goal of enabling scalability and HA by default!

About enabling Replication Chains:
Enabling log-slave-updates on a replica means, the replica writes updates that are received from a master to its own binary logs. So a replica can become a intermediate master of another replica. This option is a stepping stone for various simple to complex level replication setups and new technologies like Group Replication.

Example setups:


Worklogs implemented:

WL#10470 – Defaults: Enable Binary Log (log_bin: ON)
WL#10479 – Defaults: Enable Replication Chains (log_slave_updates: ON)

Configuration

Here is how you can configure the above mentioned three use-cases (UseCase#):
1.  To replicate, the only command-line option you need now is server-id. The binary logging is enabled by default. We still recommend that you set –log-bin=<BASENAME>, otherwise it uses the hostname, which a system administrator could potentially change. But, it is no longer strictly required to set any option.

For examples:

Notes:
– It is a good practice to set –log-bin to specific values on servers. Similarly, –relay-log can be specified too, to some specific values.

2. To have binary log enabled without replication, you don’t need to set anything. We still recommend users to set server-id=1 for such cases, in order to silence a warning that is otherwise printed at startup.

For examples:

Notes:
– Warning about providing server-id (if not set) appears regardless of whether it is log-bin or skip-log-bin. This is to ensure that user sets unique server-id even for replicas without a binary log. server-id can be set in the configuration file or even changed dynamically. The recommended way is to set it in the configuration file.

3. To disable binary logs and replication (to save space), set –skip-log-bin or –disable-log-bin,  and –server-id=1 (to avoid warning).

 

Upgrade consideration:

There is a minor upgrade impact to the users who don’t want binary logging. They need to start server with –skip-log-bin or –disable-log-bin,  and –server-id=1 (to avoid warning). We are keeping binary logging as an opt-out rather than an opt-in thing from MySQL 8.0.3 onwards.

Conclusion

Most production installations have the binary log enabled as it’s used for replication and point-in-time recovery. Enabling binary logging and replication chains by default means users can start prototyping quickly, and can move from prototype of realistic deployment with minimum hassle. It also means, less configurations for replication (async, semi-sync), group replication, and InnoDB Cluster! 🙂

Stay tuned for more blog posts. Note that MySQL 8.0.3 is a release candidate, thus it is not production ready yet. But, please don’t restrict yourselves from providing us with your valuable feedback. You can get to us through: bug reports, feature requests, the replication mailing list or by leaving a comment on this blog post.

Thanks for using MySQL Replication!