MySQL Blog Archive
For the latest blogs go to blogs.oracle.com/mysql
MySQL InnoDB Cluster – Changing cluster topology modes "live"

As listed in the release announcement of the latest MySQL InnoDB Cluster release, 8.0.14 brings exciting new features! This blog post is the first of a series detailing every single new feature added, starting by: “Changing cluster topology modes ‘live‘”.

Cluster topology modes

The AdminAPI provides the means to create an InnoDB cluster to run on single-primary mode or multi-primary mode. By default, a cluster setup runs in single-primary mode, i.e. the cluster has a single-primary server that accepts read and write queries (R/W), meanwhile all the remaining members accept only read queries (R/O). In multi-primary mode, all the members of the cluster are primaries, i.e. accept both read and write queries (R/W).

Note: multi-primary mode is considered an advanced mode due to its limitations.

The primary instance in a single-primary cluster is always the first instance of the cluster (seed instance), i.e. the instance on which the cluster was created. Whenever that instance leaves the group (intentionally or unintentionally), the primary election mechanism is triggered and the instance with the lowest UUID or greater member weight is elected as the new primary.

Both of these modes have their use cases, but it’s currently impossible to switch from one mode to the other with no downtime as it implies dissolving the cluster and re-creating it with the desired mode. Also, it’s currently impossible to trigger the election of a new primary in single-primary mode.

In 8.0.14, we have introduced the ability to change the cluster topology modes “live“!

Changing cluster topology modes “live”

It is now possible to change from multi-primary to single-primary mode (and vice-versa) without any downtime. Whenever switching to single-primary mode it’s also possible to select which of the cluster members shall become the primary instance. Finally, we also introduced the ability to force the election of a new primary member in single-primary mode.

Note: The underlying Group Replication premises ensure the transparent coordination of members, super-read-only handling, and any other necessary steps.

Summarizing, some of the most important user stories regarding the cluster topology changes are:

  • As a DBA, I want to be able to choose a new primary member of a single-primary InnoDB cluster, without having to remove it from the cluster or perform any cluster topology changes.
  • As a DBA, I want to change a single-primary InnoDB cluster to multi-primary mode without any cluster downtime.
  • As a DBA, I want to change a multi-primary InnoDB cluster to single-primary mode without any cluster downtime.
  • As a DBA, I want to change a multi-primary InnoDB cluster to single-primary mode without any cluster downtime, and select which member will be the primary.

In order to support such features, the AdminAPI was extended with three new commands:

  • <Cluster.>switchToSinglePrimaryMode([instance])

Switches a cluster to single-primary mode.

  • <Cluster.>switchToMultiPrimaryMode()>

Switches a cluster to multi-primary mode.

  • <Cluster.>setPrimaryInstance(instance)

Elects a specific cluster member as the new primary.

Try it now and send us your feedback

MySQL Shell 8.0.14 GA is available for download from the following links.

The documentation of MySQL Shell can be found in https://dev.mysql.com/doc/mysql-shell/8.0/en/ and the official documentation of InnoDB cluster can be found in the MySQL InnoDB Cluster User Guide.

Enjoy, and Thank you for using MySQL!