In this article, we will explore the Google cloud platform’s Database Migration Service or DMS. We are also going to walk through a quick, simple migration to Cloud SQL using it. Database migration service makes it fast and easy to move your MySQL or PostgreSQL database to our managed CloudSQL service. DMS provides a simple, integrated experience to guide you through every step of the migration. It’s serverless, so you don’t need to worry about managing or monitoring instances.
And continuous data replication means you can cut over with minimal downtime. Whether your database is on-premise, self-hosted in Google Cloud, or running on another Cloud, DMS helps you quickly unlock the benefits of managed Cloud SQL. Now, let’s walk through the DMS experience for a new migration job. You can access DMS from the Google Cloud console navigation under Databases. Just click Database Migration.
To get started, you’ll create a migration job. This represents the end-to-end process of moving your source database to a Cloud SQL destination.
First, let’s define what kind of migration the job will run. We want to move a MySQL database that we are running on GCE to Cloud SQL. We can choose between onetime or continuous replication. We’ll select continuous for minimal downtime. Once we’ve defined our job, DMS shows us the source and connectivity configuration required to be able to connect to and migrate the source database.
DMS makes it easy to know what we need to do to prepare by showing us the prerequisites directly in the UI. It also supports the setup of multiple networking connectivity options, including secure private connectivity with built-in scripts for easy execution.
If we need to make changes to the configuration of our source database, we can click Save and Exit to pick up where we left off later. We are ready to define our source. We can do this by creating a connection profile, a resource that represents the information needed to connect to a database.
These profiles aren’t locked to an individual migration. This means we can reuse it if we want to first test out the migration or if someone else in our organization is in charge of connecting to the database.
We have already created a connection profile for a MySQL database running on GCE, so we’ll select it.
Now we are ready to create the cloud SQL instance that we’ll migrate our database to. This will feel familiar to anyone that’s created a CloudSQL instance before. You’ll see many of the same options, like connectivity and machine configuration. Since DMS relies on the replication technology of the Database Engine, we don’t have to create resources, aside from the Cloud SQL instance we’ve just defined.
We are ready to define how our new instance will securely connect to our source database for continuous data replication. We have a few options. We can choose to allow list the IP address of the Cloud SQL destination on the database sources machine. We can set up private connectivity through a reverse SSH tunnel on a VM in our project. Or we can set up VPC peering.
Since our source is already running on Google Cloud, we’ll choose VPC peering. And that was it.
We’ve configured our source, created a Cloud SQL destination, and established connectivity between them. All that’s left is to validate the migration job setup and start our migration.
Our migration job validation passed successfully.
We can trust that our migration will run smoothly. We’ll create and start the job to run it immediately.
Once our migration job has started, we can monitor its progress and see if it encounters any issues. DMS will first transfer the initial snapshot of existing data, then continuously replicate changes as they happen.
And since DMS is serverless, we never have to worry about the migration resources themselves. That’s it. We’ve quickly and easily shown you one of the ways to migrate a MySQL database out of GCE and into Cloud SQL using DMS. When the initial snapshot’s migrated and continuous replication is keeping up, we can promote Cloud SQL to be my primary instance and point our applications to work directly against it. Google Cloud’s new database migration service is the fast, easy, and reliable way to migrate with minimal downtime to a managed Cloud SQL database for both MySQL and PostgreSQL.It’s serverless, high performance, and free to use.