When somebody wants to migrate from a single MySQL instance to a full HA solution using MySQL InnoDB Cluster, the best solution to reduce the downtime is to use asynchronous replication and switch database only once at a certain point in time when everything is ready. This is almost what I explained already in this post.
The most difficult part was related to the provisioning of the existing data to the new cluster members. A backup (physical or logical) was required. It should have been restored on every nodes and we had to be sure to not mess up with the GTIDs.
This is not more the case since MySQL 8.0.17 ! Now we can use the CLONE plugin to start the cluster provisioning too.
We have a single instance of MySQL 8.0.17 to serve the application. If that server crashes, we don’t have database service available anymore.
That’s the reason why we want to setup a MySQL InnoDB Cluster.
We install an empty MySQL server 8.0.17 on a new machine:
When the server is installed, we start it and as the finality is to use MySQL InnoDB Cluster, we enable directly GTIDs on both servers. Then we install the CLONE Plugin on it. We install the CLONE Plugin on the production server too (
single:3306 in the
clone_valid_donor_list and we initiate a remote clone from
Now that we have a new server with a snapshot of the production’s data, we can create an InnoDB Cluster out of it.
When the cluster is created with a single member, we can add the other 2 new servers. They will also get their initial snapshot from
mysql1 using CLONE.
The fully HA cluster is ready and running with 3 members. We need to recover all the data that was written in production while we were creating this awesome cluster.
Therefor, we will use Asynchronous Replication from
single to the Primary Member in the Cluster (
mysql1). We wait for the cluster to catch up before we continue.
Finally, we can bootstrap the MySQL Router. Ideally on the app server. When the router is installed (
bootstrap), we can start it and stop the application. This is the only downtime, very short during the full migration. After having stopped the application, we can restart it and this time the application needs to connect to the MySQL Router.
You can now watch all the steps on the video below):
It’s now very easy to migrate from an architecture to a new one using the CLONE Plugin. Also this plugin really simplify the cluster creation when new nodes need to be added.