将 Azure VM 移动到另一个 Azure 区域Move Azure VMs to another Azure region

你可能想要将 Azure 基础结构即服务 (IaaS) 虚拟机从一个区域移到另一个区域,以提高可靠性、可用性或更好地满足监管要求。You might want to move Azure infrastructure as a service (IaaS) virtual machines from one region to another to improve reliability, availability, management, or governance. 本教程介绍如何使用 Azure Site Recovery 将 VM 移到另一区域。This tutorial shows you how to move VMs to another region by using Azure Site Recovery. 将了解如何执行以下操作:You'll learn how to:

  • 验证先决条件Verify prerequisites
  • 准备源 VMPrepare the source VMs
  • 准备目标区域Prepare the target region
  • 将数据复制到目标区域Copy data to the target region
  • 测试配置Test the configuration
  • 执行移动Perform the move
  • 丢弃源区域中的资源Discard the resources from the source region

重要

本文介绍如何将 Azure VM 按原样从一个区域移到另一个区域。 This article describes how to move Azure VMs from one region to another as is.

先决条件Prerequisites

  • 请确保要从中进行移动的源 Azure 区域中包含 Azure VM。 Make sure that you have Azure VMs in the source Azure region that you want to move from.
  • 验证所选的源区域 - 目标区域组合是否受支持,并慎重选择目标区域。Verify that your choice of source region-target region combination is supported, and carefully choose the target region.
  • 请确保了解方案体系结构和组件Make sure that you understand the scenario architecture and components.
  • 查看支持限制和要求Review the support limitations and requirements.
  • 验证帐户权限。Verify account permissions. 如果你刚刚创建了试用版 Azure 帐户,那么你 就是订阅的管理员。If you just created your trial Azure account, you are the administrator of your subscription. 如果你不是管理员,请咨询管理员,以获取所需的权限:If you aren't the administrator, work with the administrator to get the permissions that you need:
    • 若要启用 VM 复制并使用 Site Recovery 将数据复制到目标,必须有权在 Azure 资源中创建 VM。To enable replication for a VM and copy data to the target by using Site Recovery, you must have permissions to create a VM in your Azure resources. “虚拟机参与者”内置角色具有这些权限。The Virtual Machine Contributor built-in role has these permissions. 使用这些权限可以:With the permissions, you can:

      • 在所选资源组中创建 VM。Create a VM in the selected resource group.
      • 在所选虚拟网络中创建 VM。Create a VM in the selected virtual network.
      • 向所选存储帐户进行写入。Write to the selected storage account.
    • 还需要管理 Site Recovery 操作的权限。You also need permissions to manage Site Recovery operations. “Site Recovery 参与者”角色拥有管理 Azure 恢复服务保管库中 Site Recovery 操作所需的全部权限。The Site Recovery Contributor role has all the permissions that are required to manage Site Recovery operations in an Azure Recovery Services vault.

准备源 VMPrepare the source VMs

  1. 检查要移动的 Azure VM 上是否存在最新的根证书。Check that the Azure VMs that you plan to move have the latest root certificates. 如果没有,则会出于安全约束的原因,无法将数据复制到目标区域。If they don't, you can't enable data copy to the target region because of security constraints.

    • 对于 Windows VM,请安装最新的 Windows 更新,使所有受信任的根证书位于该计算机上。For Windows VMs, install the latest Windows updates so that all the trusted root certificates are on the machine. 在离线环境中,请遵循组织的标准 Windows 更新和证书更新过程。In a disconnected environment, follow the standard Windows Update and certificate-update processes for your organization.
    • 对于 Linux VM,请遵循 Linux 分销商的指导获取最新的受信任根证书和证书吊销列表。For Linux VMs, follow guidance from your Linux distributor to get the latest trusted root certificates and certificate revocation list.
  2. 确保未使用身份验证代理来控制要移动的 VM 的网络连接。Make sure that you're not using an authentication proxy to control network connectivity for VMs that you plan to move.

  3. 如果要移动的 VM 无法访问 Internet,并且使用防火墙代理来控制出站访问,请检查此处所述的要求。If a VM that you want to move doesn't have access to the internet and is using a firewall proxy to control outbound access, check the requirements.

  4. 阐述源网络布局以及当前使用的所有资源,包括(但不限于)要验证的负载均衡器、网络安全组和公共 IP 地址。Document the source networking layout and all resources that you're currently using, including (but not limited to) load balancers, network security groups, and public IP addresses for verification.

准备目标区域Prepare the target region

  1. 在 Azure 订阅中,验证是否允许在用于灾难恢复的目标区域中创建 VM。In your Azure subscription, verify that you can create VMs in the target region that's used for disaster recovery. 如果需要,请联系支持人员启用所需的配额。Contact Support to enable the required quota if necessary.

  2. 确保订阅提供足够的资源用于支持源 VM。Make sure that your subscription has enough resources to support your source VMs. 如果使用 Site Recovery 将数据复制到目标区域,Site Recovery 会为目标 VM 选择相同的大小或最接近的可用大小。If you're using Site Recovery to copy data to the target, it picks the same size or closest available size for the target VMs.

  3. 确保为源网络布局中标识的每个组件创建目标资源。Make sure that you create a target resource for every component that you identified in the source networking layout. 这可以确保 VM 在转接到目标区域之后,获得它们在源区域中具有的所有功能和特性。This ensures that your VMs will have all the functionality and features in the target region that they had in the source region.

    为源 VM 启用复制时,Azure Site Recovery 会自动发现并创建虚拟网络和存储帐户。Azure Site Recovery automatically discovers and creates a virtual network and storage account when you enable replication for the source VM. 你也可以预先创建这些资源,并在执行启用复制的步骤期间将这些资源分配到 VM。You can also pre-create these resources and assign them to the VM as part of the enable-replication step. 但是,其他任何资源必须在目标区域中手动创建。But you must manually create any other resources in the target region. 请参阅以下文档,根据源 VM 的配置创建最常用的网络资源。Refer to the following documents to create the most commonly used network resources based on the your source VM configuration:

    对于其他任何网络组件,请参阅 Azure 网络文档For any other networking components, see the Azure networking documentation.

  4. 若要在执行移动之前测试配置,请在目标区域中手动创建非生产网络To test the configuration before you perform the move, manually create a non-production network in the target region. 测试设置可以尽量减少对生产环境造成的干扰,也是建议的做法。Testing the setup creates minimal interference with the production environment, and we recommend it.

将数据复制到目标区域Copy data to the target region

以下步骤使用 Azure Site Recovery 将数据复制到目标区域。The following steps use Azure Site Recovery to copy data to the target region.

在除源以外的任一区域中创建保管库Create the vault in any region except the source

  1. 登录到 Azure 门户Sign in to the Azure portal.

  2. 选择“创建资源” > “监视 + 管理” > “备份和站点恢复(OMS)”。Select Create a resource > Monitoring + Management > Backup and Site Recovery(OMS).

  3. 在“名称” 中,指定易记名称 ContosoVMVaultFor Name, specify the friendly name ContosoVMVault. 如果有多个订阅,请选择合适的一个。If you have more than one subscription, select the appropriate one.

  4. 创建资源组 ContosoRGCreate a resource group ContosoRG.

  5. 指定 Azure 区域。Specify an Azure region. 若要查看受支持的区域,请参阅 Azure Site Recovery 定价详细信息To check supported regions, see Azure Site Recovery Pricing Details.

  6. 对于“恢复服务保管库”,请选择“概述” > “ConsotoVMVault” > “+复制”。 For Recovery Services vaults, select Overview > ConsotoVMVault > +Replicate.

  7. 对于“源”,请选择“Azure”。 For Source, select Azure.

  8. 对于“源位置”,请选择当前运行 VM 的 Azure 源区域。 For Source location, select the source Azure region where your VMs are currently running.

  9. 选择“Azure 资源管理器”部署模型。Select the Azure Resource Manager deployment model. 然后选择“源订阅”和“源资源组”。 Then, select the Source subscription and Source resource group.

  10. 选择“确定”以保存设置。 Select OK to save the settings.

为 Azure VM 启用复制并开始复制数据Enable replication for Azure VMs and start copying the data

Site Recovery 会检索与订阅和资源组关联的 VM 列表。Site Recovery retrieves a list of the VMs that are associated with the subscription and resource group.

  1. 选择要移动的 VM,然后选择“确定”。 Select the VM that you want to move, and then select OK.

  2. 对于“设置”,请选择“灾难恢复”。 For Settings, select Disaster recovery.

  3. 对于“配置灾难恢复” > “目标区域” ,请选择要复制到的目标区域。For Configure disaster recovery > Target region, select the target region that you're replicating to.

  4. 选择使用默认目标资源或预先创建的资源。Choose to use the default target resources or those that you pre-created.

  5. 选择“启用复制”以启动作业。 Select Enable replication to start the job.

    启用复制

测试配置Test the configuration

  1. 转到保管库。Go to the vault. 在“受保护的项” > “复制的项”中,选择要移到目标区域的虚拟机。 In Protected items > Replicated items, select the virtual machine that you want to move to the target region. 然后选择“测试故障转移” 。Then, select Test Failover.

  2. 在“测试故障转移”中,选择要用于故障转移的恢复点 :In Test Failover, select a recovery point to use for the failover:

    • 最新处理:将 VM 故障转移到由 Site Recovery 服务处理的最新恢复点。Latest processed: Fails the VM over to the latest recovery point that was processed by the Site Recovery service. 将显示时间戳。The time stamp is shown. 使用此选项无需费时处理数据,因此恢复时间目标 (RTO) 会较低。No time is spent processing data, so this option provides a low recovery time objective (RTO).
    • 最新应用一致:将所有 VM 故障转移到最新的应用一致性恢复点。Latest app-consistent: Fails over all VMs to the latest app-consistent recovery point. 将显示时间戳。The time stamp is shown.
    • 自定义:选择任何恢复点。Custom: Select any recovery point.
  3. 选择要将 Azure VM 移到的目标 Azure 虚拟网络,以测试配置。Select the target Azure virtual network to which you want to move the Azure VMs to test the configuration.

    重要

    我们建议使用单独的 Azure VM 网络来测试故障转移,而不要使用目标区域中的生产网络。We recommend that you use a separate Azure VM network for the test failover, not the production network in the target region.

  4. 若要开始测试移动,请选择“确定”。 To start testing the move, select OK. 若要跟踪进度,请选择 VM 以打开其“属性”。 To track progress, select the VM to open its Properties. 或者,选择保管库中的“测试故障转移”作业。 Or, select the Test Failover job in the vault. 然后选择“设置” > “作业” > “Site Recovery 作业”。 Then, select Settings > Jobs > Site Recovery jobs.

  5. 故障转移完成后,副本 Azure VM 会显示在 Azure 门户 >“虚拟机”中。 After the failover finishes, the replica Azure VM appears in the Azure portal > Virtual Machines. 请确保 VM 正在运行、大小适当并已连接到相应的网络。Make sure that the VM is running, sized appropriately, and connected to the appropriate network.

  6. 若要删除创建的用于测试的 VM,请在“复制的项”中选择“清理测试故障转移”。 To delete the VM that you created for testing, select Cleanup test failover on the replicated item. 在“注释”中,记下并保存与测试相关的任何观测结果。 From Notes, record and save any observations related to the test.

执行移动并确认Perform the move and confirm

  1. 转到保管库,在“受保护的项” > “复制的项”中选择虚拟机,然后选择“故障转移”。 Go to the vault in Protected items > Replicated items, select the virtual machine, and then select Failover.

  2. 对于“故障转移”,请选择“最新” 。For Failover, select Latest.

  3. 选择“在开始故障转移前关闭计算机” 。Select Shut down machine before beginning failover. Site Recovery 在触发故障转移之前会尝试关闭源 VM。Site Recovery tries to shut down the source VM before triggering the failover. 但是,即使关机失败,故障转移也仍会继续。But failover continues even if shutdown fails. 可以在“作业” 页上跟踪故障转移进度。You can follow the failover progress on the Jobs page.

  4. 作业完成后,检查 VM 是否按预期显示在目标 Azure 区域中。When the job is finished, check that the VM appears in the target Azure region as expected.

  5. 在“复制的项” 中,右键单击 VM 并选择“提交” 。In Replicated items, right-click the VM and select Commit. 随后会完成迁移。This finishes the move. 请等待提交作业完成。Wait until the commit job finishes.

丢弃源区域中的资源Discard the resources from the source region

  • 转到 VM 并选择“禁用复制” 。Go to the VM and select Disable Replication. 这会停止复制 VM 数据的过程。This stops the process of copying the data for the VM.

    重要

    完成此步骤可避免在移动后 Site Recovery 复制产生费用。Complete this step to avoid being charged for Site Recovery replication after the move.

如果不打算再次使用任何源资源,请执行以下步骤:If you don't plan to reuse any of the source resources, follow these steps:

  1. 删除在准备源 VM 的步骤 4 中列出的、位于源区域中的所有相关网络资源。Delete all relevant network resources in the source region that you listed in step 4 of Prepare the source VMs.
  2. 删除源区域中的相应存储帐户。Delete the corresponding storage account in the source region.

后续步骤Next steps

本教程已介绍如何将 Azure VM 移到不同的 Azure 区域。In this tutorial, you learned how to move Azure VMs to a different Azure region. 接下来,可为这些 VM 配置灾难恢复。Now you can configure disaster recovery for those VMs.