Migrating MySQL Application to Google Cloud: Minimal Downtime and Data Loss

Migrate MySQL Application to Google Cloud with Minimal Modification

Question

You are moving an application that uses MySQL from on-premises to Google Cloud.

The application will run on Compute Engine and will use Cloud SQL.

You want to cut over to the Compute Engine deployment of the application with minimal downtime and no data loss to your customers.

You want to migrate the application with minimal modification.

You also need to determine the cutover strategy.

What should you do?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

A.

The correct answer is C.

Option A is incorrect because it involves modifying the application's source code, which the question asks to minimize, and also it requires the application to read from two databases, which increases complexity and potential for errors.

Option B is incorrect because it does not address how to minimize downtime and data loss during cutover.

Option C is the best answer because it involves replicating data from the on-premises MySQL server to Cloud SQL, minimizing downtime, and data loss. Here are the steps in more detail:

  1. Set up Cloud VPN to provide private network connectivity between the Compute Engine application and the on-premises MySQL server.

    • This allows secure communication between the Compute Engine application and the on-premises MySQL server.
  2. Stop the on-premises application.

    • This ensures that no new data is written to the on-premises MySQL server during the migration process.
  3. Start the Compute Engine application, configured to read and write to the on-premises MySQL server.

    • This ensures that the Compute Engine application can start working while the data is being migrated.
  4. Create the replication configuration in Cloud SQL.

    • This sets up the replication process to copy data from the on-premises MySQL server to Cloud SQL.
  5. Configure the source database server to accept connections from the Cloud SQL replica.

    • This allows Cloud SQL to replicate data from the on-premises MySQL server.
  6. Finalize the Cloud SQL replica configuration.

    • This ensures that the Cloud SQL replica is ready to receive data from the on-premises MySQL server.
  7. When replication has been completed, stop the Compute Engine application.

    • This ensures that all data has been replicated to Cloud SQL.
  8. Promote the Cloud SQL replica to a standalone instance.

    • This makes the Cloud SQL instance the primary database for the application.
  9. Restart the Compute Engine application, configured to read and write to the Cloud SQL standalone instance.

    • This ensures that the application is now using the Cloud SQL instance as its primary database.

This approach minimizes downtime and data loss because the Compute Engine application can continue to read and write data to the on-premises MySQL server while the data is being replicated to Cloud SQL. Once the replication is complete, the application can be switched over to use the Cloud SQL instance as its primary database, ensuring that there is no data loss.