Skip to content

Commit a3c7776

Browse files
Merge pull request #3170 from DougAnsonAustinTX/azure-lns-mysql-migration
azure lift and shift migration of mysql
2 parents 27a93a3 + 11cff1c commit a3c7776

14 files changed

Lines changed: 607 additions & 0 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: Migrate MySQL from on-premises x64 to Azure Cobalt 100 Arm VMs
3+
4+
description: Learn how to migrate a MySQL database from an on-premises x64 environment to an Arm-based Azure Cobalt 100 VM and validate performance with sysbench.
5+
6+
draft: true
7+
cascade:
8+
draft: true
9+
10+
minutes_to_complete: 30
11+
12+
who_is_this_for: This Learning Path is for developers who want to migrate MySQL from an on-premises x64 environment to an Arm-based Azure Cobalt 100 virtual machine.
13+
14+
learning_objectives:
15+
- Provision an Arm-based Azure Cobalt 100 virtual machine by using Terraform and Azure CLI.
16+
- Export and restore a MySQL database from an on-premises x64 simulator into the Arm VM.
17+
- Run sysbench on the migrated database and interpret key performance metrics.
18+
19+
prerequisites:
20+
- A [Microsoft Azure](https://azure.microsoft.com/) account with access to Cobalt 100 based instances (Dpsv6)
21+
- Basic familiarity with SSH and MySQL command-line tools
22+
23+
24+
author: Doug Anson
25+
26+
### Tags
27+
skilllevels: Introductory
28+
subjects: Performance and Architecture
29+
cloud_service_providers:
30+
- Microsoft Azure
31+
32+
armips:
33+
- Neoverse
34+
35+
tools_software_languages:
36+
- MySQL
37+
- Terraform
38+
- Azure CLI
39+
- sysbench
40+
- Bash
41+
42+
operatingsystems:
43+
- Linux
44+
45+
further_reading:
46+
- resource:
47+
title: Azure Virtual Machines documentation
48+
link: https://learn.microsoft.com/en-us/azure/virtual-machines/
49+
type: documentation
50+
- resource:
51+
title: Copying MySQL databases to another machine
52+
link: https://dev.mysql.com/doc/refman/8.4/en/copying-databases.html
53+
type: documentation
54+
- resource:
55+
title: mysqldump reference
56+
link: https://dev.mysql.com/doc/refman/8.4/en/mysqldump.html
57+
type: documentation
58+
- resource:
59+
title: sysbench benchmarking tools for MySQL
60+
link: https://manpages.ubuntu.com/manpages/trusty/man1/sysbench.1.html
61+
type: documentation
62+
63+
64+
### FIXED, DO NOT MODIFY
65+
# ================================================================================
66+
weight: 1 # _index.md always has weight of 1 to order correctly
67+
layout: "learningpathall" # All files under learning paths have this same wrapper
68+
learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content.
69+
---
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
# ================================================================================
3+
# FIXED, DO NOT MODIFY THIS FILE
4+
# ================================================================================
5+
weight: 21 # Set to always be larger than the content in this path to be at the end of the navigation.
6+
title: "Next Steps" # Always the same, html page title.
7+
layout: "learningpathall" # All files under learning paths have this same wrapper for Hugo processing.
8+
---
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: Understand Azure Cobalt 100 VMs and MySQL migration strategy
3+
4+
weight: 2
5+
6+
layout: "learningpathall"
7+
---
8+
9+
### Azure Cobalt 100 Arm-based processor
10+
11+
Azure’s Cobalt 100 is Microsoft’s first-generation, in-house Arm-based processor. Built on Arm Neoverse N2, Cobalt 100 is a 64-bit CPU that delivers strong performance and energy efficiency for cloud-native, scale-out Linux workloads such as web and application servers, data analytics, open-source databases, and caching systems. Running at 3.4 GHz, Cobalt 100 allocates a dedicated physical core for each vCPU, which helps ensure consistent and predictable performance.
12+
13+
To learn more, see the Microsoft blog [Announcing the preview of new Azure VMs based on the Azure Cobalt 100 processor](https://techcommunity.microsoft.com/blog/azurecompute/announcing-the-preview-of-new-azure-vms-based-on-the-azure-cobalt-100-processor/4146353).
14+
15+
### MySQL Migrations
16+
17+
MySQL is a cross-platform relational database system whose storage engines and on-disk formats are designed for reliability and portability. When you move between CPU architectures, such as x64 to Arm, MySQL documentation recommends a logical migration instead of copying raw data files.
18+
19+
A practical approach is to use `mysqldump` to export SQL, transfer the dump, and import it on the Arm target with the `mysql` client. The MySQL 8.4 Reference Manual also recommends this approach for cross-architecture transfers.
20+
21+
22+
## What you've learned and what's next
23+
24+
You now have the background on Azure Cobalt 100 and the recommended MySQL migration method for x64-to-Arm moves.
25+
26+
Next, you'll create a simulated on-premises x64 server in Azure and prepare it as the migration source environment.
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
---
2+
title: Benchmarking with Arm-based Azure Cloud MySQL
3+
4+
weight: 6
5+
6+
layout: "learningpathall"
7+
---
8+
9+
### Introduction
10+
11+
In this section, you'll run sysbench on the Arm-based Azure MySQL instance and review core performance metrics.
12+
13+
14+
### Preparing to run the benchmark
15+
16+
From your local machine, open an SSH shell to the on-premises simulator by replacing `YOUR_RSA_FILENAME` and `YOUR_ONPREM_IP_ADDRESS`:
17+
18+
```bash
19+
ssh -i $HOME/.ssh/YOUR_RSA_FILENAME azureadmin@YOUR_ONPREM_IP_ADDRESS
20+
```
21+
22+
From that on-premises shell, identify the SSH key in `$HOME/.ssh` used for the Azure VM. Then connect to the Arm-based Azure VM:
23+
24+
```bash
25+
ssh -i $HOME/.ssh/AZURE_CLOUD_RSA_FILENAME azureadmin@YOUR_ARM_BASED_VM_PUBLIC_IP_ADDRESS
26+
```
27+
28+
You should now have an SSH shell into your Arm-based Azure VM.
29+
30+
Next, create a file named `run.sh` with the following content:
31+
32+
```bash
33+
#!/bin/bash
34+
35+
36+
run_bench() {
37+
THR=$1
38+
LENGTH=$2
39+
FILENAME=${PREFIX}_${THR}.perf
40+
if [ -f ${FILENAME} ]; then
41+
rm ${FILENAME}
42+
fi
43+
set -x
44+
sysbench /usr/share/sysbench/oltp_read_write.lua --table-size=1000000 --db-driver=mysql --mysql-db=testdb --mysql-user=${ADMIN} --mysql-password=${PW} --time=${LENGTH} --max-requests=0 --threads=${THR} run 2>&1 1>${FILENAME}
45+
set +x
46+
}
47+
48+
main() {
49+
run_bench 16 60
50+
run_bench 32 60
51+
run_bench 64 60
52+
run_bench 96 60
53+
run_bench 128 60
54+
}
55+
56+
export ADMIN=$1
57+
export PW=$2
58+
export PREFIX=$3
59+
shift 3
60+
61+
main $*
62+
```
63+
64+
Make the script executable:
65+
66+
```bash
67+
sudo chmod 755 ./run.sh
68+
```
69+
70+
In the same shell, retrieve the MySQL root password file used by the migration script:
71+
72+
```bash
73+
sudo su -
74+
cat /root/mysql_root_password.txt
75+
```
76+
77+
### Running the benchmark
78+
79+
Run `run.sh`, replacing `AZURE_CLOUD_MYSQL_ADMIN_PW` with the password value you just retrieved:
80+
81+
```bash
82+
./run.sh admin AZURE_CLOUD_MYSQL_ADMIN_PW cobalt_100_arm64
83+
```
84+
85+
The script creates five `.perf` files with sysbench `oltp_read_write` results at different thread counts.
86+
87+
### Interpreting the results
88+
89+
First, download the five `.perf` files from the Azure VM to your on-premises simulator shell. Replace `AZURE_CLOUD_RSA_FILENAME` and `YOUR_ARM_BASED_VM_PUBLIC_IP_ADDRESS`:
90+
91+
```bash
92+
cd $HOME
93+
scp -i $HOME/.ssh/AZURE_CLOUD_RSA_FILENAME azureadmin@YOUR_ARM_BASED_VM_PUBLIC_IP_ADDRESS:*.perf .
94+
```
95+
96+
Next, from your local machine, copy those files from the on-premises simulator to your local host. Replace `ON_PREM_RSA_FILENAME` and `YOUR_ON_PREM_SIM_IP_ADDRESS`:
97+
98+
```bash
99+
cd $HOME
100+
scp -i $HOME/.ssh/ON_PREM_RSA_FILENAME azureuser@YOUR_ON_PREM_SIM_IP_ADDRESS:*.perf .
101+
```
102+
103+
You should now have five `.perf` files on your local host.
104+
105+
To summarize key metrics quickly, run:
106+
107+
```bash
108+
for f in *.perf; do
109+
echo "== $f =="
110+
grep -E "threads:|transactions:|queries:|95th percentile:" "$f"
111+
echo
112+
done
113+
```
114+
115+
Use these values to compare throughput and latency across thread counts:
116+
117+
- Higher `transactions:` values indicate better throughput.
118+
- Lower `95th percentile:` values indicate better tail latency.
119+
- Look for where adding threads no longer increases throughput meaningfully.
120+
121+
The following example image shows benchmark output from this workflow:
122+
123+
![Azure Cobalt 100 Arm64 E4pds_v6 sysbench results#center](images/benchmark.png "Azure Cobalt 100 Arm64 E4pds_v6 sysbench results")
124+
125+
### What we learned
126+
127+
You learned how to provision an Arm-based Azure VM for MySQL migration, move a database from an on-premises x64 simulator, and evaluate performance by reading sysbench throughput and latency metrics.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: Create an Azure X64 virtual machine as an "on-prem simulator"
3+
weight: 3
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
### Overview
10+
11+
In this section, you'll use the Azure portal to create a virtual machine with an x64 processor architecture.
12+
13+
This VM acts as your simulated on-premises x64 MySQL server.
14+
15+
### Create an Azure x64 virtual machine
16+
17+
To create an Azure virtual machine:
18+
19+
- Launch the Azure portal and navigate to **Virtual Machines**.
20+
- Select **Create**, and select **Virtual Machine** from the drop-down list.
21+
- Inside the **Basic** tab, fill in the instance details such as **Virtual machine name** and **Region**.
22+
- Select the image for your virtual machine (for example, Ubuntu Pro 24.04 LTS) and select **x64** as the VM architecture.
23+
- In the **Size** field, select **See all sizes** and select the D-Series v6 family of virtual machines.
24+
- Select **D4ads_v6** from the list as shown in the diagram below:
25+
26+
![Azure Portal showing D-Series v6 VM size selection with x64 D4ads_v6 highlighted#center](images/instance.png "Select D4ads_v6 from the D-Series v6 x64 family")
27+
28+
- For **Authentication type**, select **SSH public key**.
29+
30+
{{% notice Note %}}
31+
Azure can generate an SSH key pair for you and lets you save it for future use.
32+
{{% /notice %}}
33+
34+
- Fill in the **Administrator username** for your VM.
35+
- Select **Generate new key pair**, and select **RSA SSH Format** as the SSH Key Type.
36+
37+
{{% notice Note %}}
38+
RSA offers better security with keys longer than 3072 bits.
39+
{{% /notice %}}
40+
41+
- Give your SSH key a key pair name.
42+
- In the **Inbound port rules**, select **HTTP (80)** and **SSH (22)** as the inbound ports, as shown below:
43+
44+
![Azure Portal showing inbound port rules with HTTP (80) and SSH (22) selected#center](images/instance1.png "Configure inbound port rules for HTTP and SSH access")
45+
46+
- Now select the **Review + Create** tab and review the configuration for your virtual machine. It should look like the following:
47+
48+
![Azure Portal Review + Create tab showing VM configuration summary ready for deployment#center](images/instance3.png "Review VM configuration before creation")
49+
50+
- When you're happy with your selection, select the **Create** button and then **Download Private key and Create Resource** button.
51+
52+
![Azure Portal showing Create button and SSH key download dialog#center](images/instance4.png "Download SSH key and create the virtual machine")
53+
54+
Your virtual machine should be ready and running in a few minutes. You can SSH into the virtual machine using the private key, along with the public IP details.
55+
56+
![Azure Portal showing successful VM deployment with confirmation details#center](images/final-vm.png "Successful VM deployment confirmation")
57+
58+
{{% notice Note %}}To learn more about virtual machines in Azure, see "Getting Started with Microsoft Azure" in [Get started with cloud instances](/learning-paths/servers-and-cloud-computing/csp/azure/).{{% /notice %}}
59+
60+
## What you've learned and what's next
61+
62+
You've created an Azure x64 virtual machine running Ubuntu 24.04 LTS with SSH authentication configured. The virtual machine is now ready to act as your simulated on-premises environment for this Learning Path.
63+
64+
Next, you will prepare this environment by installing MySQL and loading a sample database for migration.
201 KB
Loading
38.9 KB
Loading
218 KB
Loading
84 KB
Loading
137 KB
Loading

0 commit comments

Comments
 (0)