arrow_back

Migrate MySQL Data to Cloud SQL using Database Migration Service: Challenge Lab

登录 加入
访问 700 多个实验和课程

Migrate MySQL Data to Cloud SQL using Database Migration Service: Challenge Lab

实验 1 小时 30 分钟 universal_currency_alt 1 个积分 show_chart 入门级
info 此实验可能会提供 AI 工具来支持您学习。
访问 700 多个实验和课程

GSP351

Google Cloud self-paced labs logo

Overview

In a challenge lab you’re given a scenario and a set of tasks. Instead of following step-by-step instructions, you will use the skills learned from the labs in the course to figure out how to complete the tasks on your own! An automated scoring system (shown on this page) will provide feedback on whether you have completed your tasks correctly.

When you take a challenge lab, you will not be taught new Google Cloud concepts. You are expected to extend your learned skills, like changing default values and reading and researching error messages to fix your own mistakes.

To score 100% you must successfully complete all tasks within the time period!

This lab is recommended for students enrolled in the Migrate MySQL Data to Cloud SQL using Database Migration Service skill badge. Are you ready for the challenge?

Setup and requirements

Before you click the Start Lab button

Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources are made available to you.

This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).
Note: Use an Incognito (recommended) or private browser window to run this lab. This prevents conflicts between your personal account and the student account, which may cause extra charges incurred to your personal account.
  • Time to complete the lab—remember, once you start, you cannot pause a lab.
Note: Use only the student account for this lab. If you use a different Google Cloud account, you may incur charges to that account.

Set your region and zone

Certain Compute Engine resources live in regions and zones. A region is a specific geographical location where you can run your resources. Each region has one or more zones.

Run the following gcloud commands in Cloud Shell to set the default region and zone for your lab:

gcloud config set compute/zone "{{{project_0.default_zone|ZONE}}}" export ZONE=$(gcloud config get compute/zone) gcloud config set compute/region "{{{project_0.default_region|REGION}}}" export REGION=$(gcloud config get compute/region)

Challenge scenario

Your employer has existing MySQL databases running on a Compute Engine instance. They want to migrate this database to two new Cloud SQL instances using two different migration strategies. For the initial migration you must perform a one-time migration using the external IP address of the compute instance to gain access to the source database. For the second migration you have been instructed to use VPC Peering for access to the source database to remove the dependency on the external ip-address.

Before you cut over to the newly migrated database, you must carry out a test to confirm that the migration has been successful. To perform this final test you must make some changes to the source database after the continuous migration job has been started, and then check that those changes are propagated by the Database Migration Service. Finally the destination instance (Cloud SQL for MySQL) must be promoted to a stand-alone database for reading and writing data.

Note: For the purposes of this lab, all of your resources should be created in the following region: and zone: .

Task 1. Configure a Database Migration Service connection profile for a stand-alone MySQL database

  • To complete this task you must configure a connection profile for the migration of the MySQL source instance, running on a compute instance named , to Cloud SQL using a Database Migration Service one-time migration and the external IP address of the source instance.

The credentials for this source database are provided in the table below:

Property Value
Username admin
Password changeme
Note: You should use the external IP address of the MySQL source instance to provide access to the source database for this connection profile, and the following region: . Configure a Database Migration Service connection profile for a stand-alone MySQL database.

Task 2. Perform a one-time migration of a stand-alone MySQL database to Cloud SQL

  1. You must migrate this compute instance based MySQL database to a Cloud SQL instance configured with the following properties:
Property Value
Cloud SQL Destination Instance ID
Root password supersecret!
Choose a Cloud SQL edition Enterprise
Database version Cloud SQL for MySQL 8
Machine Shape 2 vCPU,8 GB
Storage type SSD
Storage capacity 10GB
  1. Once you have migrated this database to a Cloud SQL instance you can confirm that the data has populated the Cloud SQL MySQL database by connecting to the new Cloud SQL MySQL database and running the following query:
use customers_data; select count(*) from customers;

If the data are migrated, this query should return a row count of 5030.

Perform a one-time migration of a stand-alone MySQL database to Cloud SQL.

Task 3. Create a continuous Database Migration Service migration job to migrate a stand-alone MySQL database to Cloud SQL

  1. To complete this task you must create a continuous Database Migration Service migration job to migrate a stand-alone MySQL database to a second Cloud SQL instance using VPC peering.

  2. You must migrate the same stand-alone MySQL database to a second Cloud SQL instance configured with the following properties:

Property Value
Cloud SQL Destination Instance ID
Root password supersecret!
Choose a Cloud SQL edition Enterprise
Database version Cloud SQL for MySQL 8
CPU 2 vCPU,8 GB
Storage type SSD
Storage capacity 10GB
Note: To streamline the creation process, you can set the Migration job name to the same name as the Cloud SQL Destination Instance ID provided above.

Be sure to use the same source connection profile that you created in Task 1. For the continuous migration job, you must use VPC Peering to provide access to the source compute instance and its database.
  1. To complete this task you must start the continuous migration job you have created. Wait until the job is in the Running state before checking your progress below.
Migrate the stand-alone MySQL database to Cloud SQL using continuous migration.

Task 4. Test that the continuous Database Migration Service job replicates updated source data

  1. To complete this task you must connect to the source stand-alone MySQL instance and modify the database with the following query:
use customers_data; update customers set gender = 'FEMALE' where addressKey = 934;
  1. Allow a minute for the change to be propagated by the continuous migration job and then check the changes at the destination.
Check that the updated source data in the stand-alone MySQL database has been migrated to continuous replication Cloud SQL instance.

Task 5. Promote the destination Cloud SQL for MySQL database to a stand-alone database

  • In this task you must promote the Cloud SQL for MySQL instance to a stand-alone database for reading and writing data.
Check that the Cloud SQL for MySQL continuous migration job has been promoted to a stand-alone database for reading and writing.

Congratulations!

In this lab, you learned how to: configure a Database Migration Service connection profile for a stand-alone MySQL database; perform a one-time migration of a stand-alone MySQL database to Cloud SQL; create a continuous Database Migration Service migration job to migrate a stand-alone MySQL database to Cloud SQL; test that the continuous Database Migration Service job replicates updated source data; and promote the destination Cloud SQL for MySQL database to a stand-alone database.

Migrate MySQL data to Cloud SQL using Database Migration Service skill badge

Earn your next skill badge

This self-paced lab is part of the Migrate MySQL Data to Cloud SQL using Database Migration Service skill badge. Completing this skill badge quest earns you the badge above, to recognize your achievement. Share your badge on your resume and social platforms, and announce your accomplishment using #GoogleCloudBadge.

This skill badge quest is part of Google Cloud’s Database Engineer learning path. If you have already completed the other skill badges in this learning path, search the catalog for other skill badges in which you can enroll.

Google Cloud training and certification

...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.

Manual Last Updated January 14, 2025

Lab Last Tested January 14, 2025

Copyright 2025 Google LLC. All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.

准备工作

  1. 实验会创建一个 Google Cloud 项目和一些资源,供您使用限定的一段时间
  2. 实验有时间限制,并且没有暂停功能。如果您中途结束实验,则必须重新开始。
  3. 在屏幕左上角,点击开始实验即可开始

使用无痕浏览模式

  1. 复制系统为实验提供的用户名密码
  2. 在无痕浏览模式下,点击打开控制台

登录控制台

  1. 使用您的实验凭证登录。使用其他凭证可能会导致错误或产生费用。
  2. 接受条款,并跳过恢复资源页面
  3. 除非您已完成此实验或想要重新开始,否则请勿点击结束实验,因为点击后系统会清除您的工作并移除该项目

此内容目前不可用

一旦可用,我们会通过电子邮件告知您

太好了!

一旦可用,我们会通过电子邮件告知您

一次一个实验

确认结束所有现有实验并开始此实验

使用无痕浏览模式运行实验

请使用无痕模式或无痕式浏览器窗口运行此实验。这可以避免您的个人账号与学生账号之间发生冲突,这种冲突可能导致您的个人账号产生额外费用。