☁️Data Replication from VM MySQL to RDS for MySQL Huawei Cloud (Migration of Databases)
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.
We found our MySQL VM server on the ECS console and remote login to it with ssh or console application.
ssh root@EIP
We log in to our database.
mysql -u root -h <mysql-ip> -p -e “create database loadtest”
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
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
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.
Click Buy DB Instance
and continue.
Select the configurations as you want to. If you just test it you can select the configurations below.
Now we created our RDS instance too! Let’s log in and see how empty it is. Click the Log In
button.
Enter your password and click Test Connection
after Log In
.
As you can see our newly created RDS for MySQL database is empty.
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
.
Click Create Migration Task
.
Select the region you want to migrate your databases from and to. Define a task name and continue.
Select the configurations such as Data Flow
, DB Engine
and RDS Instance
you want to migrate to. Then click Create now
.
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.
Enter your destination RDS instance information and click Test Connection
, if it's successful, continue.
At the opening page, read the information about the migration process and click Confirm All Remarks
button then click Next
to continue.
Wait until the Check success rate
is %100.
Confirm
the details which have not been confirmed automatically.
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.
Select a time to start your migration process and O&M options as you want. Then click Submit
to start the migration.
Your migration process has started in this part. Click the Task Name
of yours and get into the task.
Select the Migration Progress
from left navigation bar and follow the progress.
After you see Full migration stopped
text without any errors, your migration process has successfully ended.
You can see the metrics of your databases in the database migration process from Cloud Eye Service
.
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.