Minimal downtime migrations for MySQL

Spanner migration tool can be used to perform minimal downtime migration for MySQL using the GUI or the CLI.

Following instructions assume you have setup SMT by following the instructions in the installation guide.

Table of contents
  1. Source database configuration
    1. Allow Datastream to connect to MySQL database
    2. Configure MySQL database for CDC
  2. CLI
  3. UI

Before attempting a minimal downtime migration, ensure you have added the necessary permissions required in the GCP account. This is documented here.

Source database configuration

Allow Datastream to connect to MySQL database

Spanner migration tool currently supports creating connection profiles via the IP whitelisting route only.

Follow the Datastream guidelines to allowlist datastream to access the source database.

Configure MySQL database for CDC

Follow the guidelines for configuring MySQL here.

It is often a good idea to create a connection profile and a Datastream stream directly via the GCP console to ensure that permissions and connectivity are correctly configured before proceeding with using SMT for a minimal downtime migration. This can be done by following the Datastream documentation.

CLI

To run a minimal downtime schema and data migration:

    $ ./spanner-migration-tool schema-and-data --source=mysql \
        --source-profile='host=host,port=3306,user=user,password=pwd,dbN\
    ame=db,streamingCfg=streaming.json' \
        --target-profile='project=spanner-project,instance=spanner-insta\
    nce'

UI

Spanner migration tool supports sharded MySQL migrations. Follow the instructions below to configure sharded migrations.

Follow the steps below to configure a minimal downtime migration are MySQL:

  1. Connect to source database.
  2. Connect to spanner instance.
  3. Convert MySQL schema to Spanner schema using the schema conversion workspace.
  4. Follow the documentation in the schema conversion workspace section of the documentation for different schema modifications that are supported by SMT. For guidance on specific data type conversion for MySQL, look at the data conversion for MySQL documentation. For guidance on schema changes for sharded MySQL migrations, look here.
  5. Configure datastream and dataflow details. Sharded migration configuration details are also available here.
  6. Wait for the migration to be orchestrated by SMT.
  7. Look at the list of generated resources for links to the Datastream stream and the Dataflow job created.