Azure VM从ASM迁移到ARM(一)

Azure的IaaS有ASM和ARM两个版本,ARM的一些优点前面已经聊过很多了。ARM有更细的管理颗粒度,更多的功能等。

如果想从ASM迁移到ARM,目前有两类方法可以实现:

1. Azure平台支持的迁移工具

2. 脚本或工具实现的VHD复制,再创建虚拟机

下面我们分别来介绍两种方式。

一、Azure平台支持的迁移工具

1. 介绍

Azure平台支持的迁移工具的实质,是将Azure VM的管理权从ASM迁移到ARM。而在这个过程中,Azure VM的Disk、Network以及CPU和Memory都没有发生改变。

这中迁移本质也是ASM和ARM管理权的转换:ASM将VM的管理权转给了ARM。

从上图可以看出,Azure的VM有两种管理管理方式:ASM和ARM。迁移前后,VM没有发生变化,只是管理者变掉了。

Azure平台支持的迁移工具可以支持以下内容的迁移:

  • Virtual Machines
  • Availability Sets
  • Cloud Services
  • Storage Accounts
  • Virtual Networks
  • VPN Gateways
  • Express Route Gateways
  • Network Security Groups
  • Route Tables
  • Reserved IPs

工具可以支持两种迁移方式:

1. 在一个Cloud Service下,但不在Vnet中,同一个Cloud Service下的资源同时迁移

2. 在一个Vnet内,所有资源同时迁移

由于客户大多是采用Vnet部署系统,本文将介绍将同一个Vnet中VM从ASM迁移到ARM中。

Vnet中的VM资源迁移共分4步:

1. Validate验证

2. Prepare准备

3. Check检查

4. Commit确认 or Abort放弃

2. 迁移过程

a. 环境

本实验有一个Vnet: hwwaf

azure network vnet list
info: Executing command network vnet list
+ Looking up the virtual network sites
data: Name Location Affinity group State Address space Subnets count VPN Gateway address
data: ----- ---------- -------------- ------- ------------- ------------- -------------------
data: hwwaf China East Created 10.1.1.0/24 2 139.217.16.184
info: network vnet list command OK

两台VM:

azure vm list
info: Executing command vm list
+ Getting virtual machines
data: Name Status Location DNS Name IP Address
data: ------- --------- ---------- ------------------------ ----------
data: hwwaf01 ReadyRole China East hwwaf01.chinacloudapp.cn 10.1.1.4
data: hwwaf02 ReadyRole China East hwwaf02.chinacloudapp.cn 10.1.1.5
info: vm list command OK

b. 4步迁移过程

1. validate

azure network vnet validate-migration hwwaf
info: Executing command network vnet validate-migration
data: Information : Deployment hwwaf02 in Cloud Service hwwaf02 is eligible for migration.
data: Information : VM hwwaf02 in Deployment hwwaf02 within Cloud Service hwwaf02 is eligible for migration.
data: Information : Deployment hwwaf01 in Cloud Service hwwaf01 is eligible for migration.
data: Information : VM hwwaf01 in Deployment hwwaf01 within Cloud Service hwwaf01 is eligible for migration.
data: Information : Virtual Network hwwaf is eligible for migration.
info: network vnet validate-migration command OK

2. Prepare

azure network vnet prepare-migration hwwaf
info: Executing command network vnet prepare-migration
info: network vnet prepare-migration command OK

3. Check

检查状态:

另外在这个vnet中有一个VPN Gateway,可以看到,做了Prepare以后,这个Gateway也准备进行迁移:

4. Commit

确认迁移:

azure network vnet commit-migration hwwaf
info: Executing command network vnet commit-migration
info: network vnet commit-migration command OK

可以看到此时VM已经运行正常:

如果希望终止迁移,可以采用下面的命令取消迁移:

network vnet abort-migration hwwaf

再查看一下VPN Gateway:

也迁移成功了。

在迁移过程中,始终进行ping的操作,ping包没有丢失。

64 bytes from 10.1.1.5: icmp_seq=5 ttl=64 time=1.48 ms
64 bytes from 10.1.1.5: icmp_seq=6 ttl=64 time=0.804 ms
64 bytes from 10.1.1.5: icmp_seq=7 ttl=64 time=0.881 ms
64 bytes from 10.1.1.5: icmp_seq=8 ttl=64 time=0.683 ms
64 bytes from 10.1.1.5: icmp_seq=9 ttl=64 time=0.882 ms
64 bytes from 10.1.1.5: icmp_seq=10 ttl=64 time=0.895 ms
64 bytes from 10.1.1.5: icmp_seq=11 ttl=64 time=1.08 ms
64 bytes from 10.1.1.5: icmp_seq=12 ttl=64 time=0.968 ms
64 bytes from 10.1.1.5: icmp_seq=13 ttl=64 time=0.810 ms
64 bytes from 10.1.1.5: icmp_seq=14 ttl=64 time=0.710 ms
64 bytes from 10.1.1.5: icmp_seq=15 ttl=64 time=0.962 ms
......
64 bytes from 10.1.1.5: icmp_seq=220 ttl=64 time=0.682 ms 64 bytes from 10.1.1.5: icmp_seq=221 ttl=64 time=0.831 ms 64 bytes from 10.1.1.5: icmp_seq=222 ttl=64 time=0.838 ms 64 bytes from 10.1.1.5: icmp_seq=223 ttl=64 time=0.926 ms 64 bytes from 10.1.1.5: icmp_seq=224 ttl=64 time=0.986 ms

总结:

通过Azure平台自带的ASM到ARM的迁移工具,可以方便的做VM的迁移。迁移包括VM和VPN Gateway。迁移的过程分几个阶段,迁移中VM没有发生中断。

下一篇文章,将介绍用MigAz的方式实现VM从ASM到ARM的迁移。

原文地址:https://www.cnblogs.com/hengwei/p/6934072.html