☁️Data Replication from VM MySQL to RDS for MySQL Huawei Cloud (Migration of Databases)

Muhammet Berke OZTURK
Huawei Developers
Published in
6 min readDec 11, 2023
Cover Image

Introduction

Hello everyone! You know that databases can be provided either in a VM or as a Service in Huawei Cloud. In this article, we are going to show you how to migrate your VM database to Huawei Cloud’s RDS service. We will be using the DRS (Data Replication Service) service to complete the full migration. If you want to learn more about DRS service please click the link. We have also an introduction article for it. So let’s begin the demonstration!!.

Migration

VM MySQL

First of all, we need to execute the MySQL server on our ECS(VM) so we can start the migration process.

Log in to the On-Prem database

We found our MySQL VM server on the ECS console and remote login to it with ssh or console application.

ssh root@EIP

Log in to the On-Prem database(2)

We log in to our database.

mysql -u root -h <mysql-ip> -p -e “create database loadtest”

Log In to MySQL

Build our temporary database data and insert them into tables.

sysbench /root/sysbench/tests/include/oltp_legacy/oltp.lua — db-driver=mysql — mysql-db=loadtest — mysql-user=root — mysql-password=’Cloud12#$’ — mysql-port=3306 — mysql-host=’<host>’ — oltp-tables-count=10 — oltp-table-size=10000 — threads=20 prepare

Creating tables

Start our database and follow it.

sysbench /root/sysbench/tests/include/oltp_legacy/insert.lua — db-driver=mysql — mysql-db=loadtest — mysql-user=root — mysql-password=’Cloud12#$’ — mysql-port=3306 — mysql-host=’<host>’ — oltp-tables-count=10 — oltp-table-size=1000 — max-time=3600 — max-requests=0 — threads=10 — report-interval=3 — rate=20 — forced-shutdown=1 run

Starting MySQL
Starting MySQL(2)

Now we have a working VM MySQL database. We should create an RDS for MySQL instance and start the migration process from VM MySQL to RDS to MySQL with DRS.

RDS for MySQL

Take the console Service List navigation bar and click the Relational Database Service section.

Navigate to RDS

Click Buy DB Instance and continue.

Create a DB Instance

Select the configurations as you want to. If you just test it you can select the configurations below.

Create a DB Instace(2)
Create a DB Instace(3)
Create a DB Instace(4)

Now we created our RDS instance too! Let’s log in and see how empty it is. Click the Log In button.

Log into the RDS Database

Enter your password and click Test Connection after Log In.

Log into RDS Database(2)

As you can see our newly created RDS for MySQL database is empty.

Log into RDS Database(3)

After two of the databases we need for migration, one for source and one for destination are created, we can start our migration process. Let’s hop on to DRS(Data Replication Service) and start the process.

Data Replication Service(DRS)

From the Service List find and click Data Replication Service.

Navigate to DRS

Click Create Migration Task.

Create a Migration Task

Select the region you want to migrate your databases from and to. Define a task name and continue.

Create a Migration Task(2)

Select the configurations such as Data Flow, DB Engine and RDS Instance you want to migrate to. Then click Create now.

Create a Migration Task(3)

Right here our replication instances are creating. We wait 3 to 5 minutes to create. After instances are created we can see its EIP.

As you know we need our 3306 port on our Security Group must be open. Like port 3306, we should allow our ECS to share data with the Replication instance. So we should open all ports to EIP of the Replication instance from our Security Group like below.

Then enter the information of your VM MySQL database and click Test Connection, if it's successful, continue.

Create a Migration Task(4)
Configuring the Security Group

Enter your destination RDS instance information and click Test Connection, if it's successful, continue.

Create a Migration Task(5)

At the opening page, read the information about the migration process and click Confirm All Remarks button then click Next to continue.

Create a Migration Task(6)

Wait until the Check success rate is %100.

Create a Migration Task(7)

Confirm the details which have not been confirmed automatically.

Create a Migration Task(8)
Create a Migration Task(9)

On the compare parameters page, you can see the parameters of your databases and compare them. You can manually change the parameters to save in the new database. After click Next to continue.

Create a Migration Task(10)

Select a time to start your migration process and O&M options as you want. Then click Submit to start the migration.

Create a Migration Task(11)

Your migration process has started in this part. Click the Task Name of yours and get into the task.

Follow the migration progress

Select the Migration Progress from left navigation bar and follow the progress.

Follow the migration progress(2)

After you see Full migration stopped text without any errors, your migration process has successfully ended.

Follow the migration progress(3)

You can see the metrics of your databases in the database migration process from Cloud Eye Service.

Follow the migration progress(4)

Conclusion

In conclusion, as you can see, we can easily migrate our On-Prem or VM MySQL database to the cloud. We used ECS, RDS for MySQL, and DRS services to create this demonstration. DRS allows you to migrate databases either in the cloud or on-prem. You can use the DRS service for any kind of database migration process. You can make the same migration process by clicking this link from Huawei Cloud’s free application platform KooLabs at no charge at all.

References

--

--