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

在许多场景中,你希望将现有 Azure IaaS 虚拟机 (VM) 从一个区域移动到另一个区域。There are various scenarios in which you'd want to move your existing Azure IaaS virtual machines (VMs) from one region to another.

可以使用 Azure Site Recovery 服务来管理和协调本地计算机和 Azure VM 灾难恢复,以实现业务连续性和灾难恢复 (BCDR)。You can use the Azure Site Recovery service to manage and orchestrate disaster recovery of on-premises machines and Azure VMs for business continuity and disaster recovery (BCDR). 此外可以使用 Site Recovery 来管理将 Azure VM 移动到次要区域的过程。You can also use Site Recovery to manage the move of Azure VMs to a secondary region.

在本教程中,你将:In this tutorial, you will:

  • 验证进行移动的先决条件Verify prerequisites for the move
  • 准备源 VM 和目标区域Prepare the source VMs and the target region
  • 复制数据和启用复制Copy the data and enable replication
  • 测试配置和执行移动Test the configuration and perform the move
  • 删除源区域中的资源Delete the resources in the source region

备注

本教程演示如何将 Azure VM 按原样从一个区域移到另一个区域。This tutorial shows you how to move Azure VMs from one region to another as is.

先决条件Prerequisites

  • 请确保 Azure VM 位于要从中移动的 Azure 区域中。Make sure that the Azure VMs are in the Azure region from which you want to move.

  • 验证所选的源区域 - 目标区域组合是否受支持,并在目标区域方面做出明智的决策。Verify that your choice of source region - target region combination is supported, and make an informed decision about 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 created your trial Azure account, you're the administrator of your subscription. 如果你不是订阅管理员,请要求管理员分配你所需的权限。If you're not the subscription administrator, work with the administrator to assign the permissions that you need. 若要为 VM 启用复制,并使用 Azure Site Recovery 按原样复制数据,必须:To enable replication for a VM and essentially copy data by using Azure Site Recovery, you must have:

    • 在 Azure 资源中创建 VM 的权限。Permissions to create a VM in Azure resources. “虚拟机参与者”内置角色具有这些权限,这包括:The Virtual Machine Contributor built-in role has these permissions, which include:

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

  • 请确保要移动的 Azure VM 上存在所有最新的根证书。Make sure that all the latest root certificates are on the Azure VMs that you want to move. 如果最新的根证书不在 VM 上,则安全性约束将阻止数据复制到目标区域。If the latest root certificates aren't on the VM, security constraints will prevent the data copy to the target region.

    • 对于 Windows VM,请在 VM 上安装所有最新的 Windows 更新,使所有受信任的根证书位于该计算机上。For Windows VMs, install all the latest Windows updates on the VM, 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 分销商提供的指导,在 VM 上获取最新的受信任根证书和证书吊销列表。For Linux VMs, follow the guidance provided by your Linux distributor to get the latest trusted root certificates and certificate revocation list on the VM.

  • 确保未使用身份验证代理来控制要移动的 VM 的网络连接。Make sure that you're not using an authentication proxy to control network connectivity for VMs that you want to move.

  • 如果尝试移动的 VM 无法访问 Internet,或使用防火墙代理来控制出站访问,请检查要求If the VM that you're trying to move doesn't have access to the internet, or it's using a firewall proxy to control outbound access, check the requirements.

  • 确定源网络布局和当前正在使用的所有资源。Identify the source networking layout and all the resources that you're currently using. 这包括但不限于负载均衡器、网络安全组 (NSG) 和公共 IP。This includes but isn't limited to load balancers, network security groups (NSGs), and public IPs.

  • 验证 Azure 订阅是否允许在用于灾难恢复的目标区域中创建 VM。Verify that your Azure subscription allows you to create VMs in the target region that's used for disaster recovery. 请联系支持部门,启用所需配额。Contact support to enable the required quota.

  • 请确保订阅中有足够的资源,能够支持大小与源 VM 匹配的 VM。Make sure that your subscription has enough resources to support VMs with sizes that match your source VMs. 如果使用 Site Recovery 将数据复制到目标区域,Site Recovery 会为目标 VM 选择相同的大小或尽可能接近的大小。If you're using Site Recovery to copy data to the target, Site Recovery chooses the same size or the closest possible size for the target VM.

  • 请确保为源网络布局中标识的每个组件创建目标资源。Make sure that you create a target resource for every component that's identified in the source networking layout. 此步骤对于确保目标区域中具有与源区域中相同的所有功能很重要。This step is important to ensure that your VMs have all the functionality and features in the target region that you had in the source region.

    备注

    为源 VM 启用复制时,Azure Site Recovery 会自动发现并创建虚拟网络。Azure Site Recovery automatically discovers and creates a virtual network when you enable replication for the source VM. 此外可以预先创建网络,并将其分配到用户流中的 VM 以启用复制。You can also pre-create a network and assign it to the VM in the user flow for enable replication. 按后文所述,需要在目标区域中手动创建其他资源。As mentioned later, you need to manually create any other resources in the target region.

    若要根据源 VM 配置创建最常用的相关网络资源,请参阅以下文档:To create the most commonly used network resources that are relevant for you based on the source VM configuration, see the following documentation:

准备Prepare

以下步骤演示如何使用 Azure Site Recovery 作为解决方案来准备要移动的虚拟机。The following steps shows how to prepare the virtual machine for the move using Azure Site Recovery as a solution.

在除了源区域之外的任意区域中创建保管库Create the vault in any region, except the source region

  1. 登录到 Azure 门户 > 恢复服务Sign in to the Azure portal > Recovery Services.

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

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

  4. 创建资源组 ContosoRG 。Create the resource group ContosoRG.

  5. 指定 Azure 区域。Specify an Azure region. 若要查看受支持的区域,请参阅 Azure Site Recovery 定价详细信息中的“地域可用性”。To check supported regions, see geographic availability in Azure Site Recovery pricing details.

  6. 在“恢复服务保管库”中,选择“概述” > “ContosoVMVault” > “+复制” 。In Recovery Services vaults, select Overview > ContosoVMVault > +Replicate.

  7. 在“源”中,选择“Azure”。 In Source, select Azure.

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

  9. 选择“资源管理器”部署模型。Select the 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,然后选择“确定” 。In the next step, select the VM that you want to move, then select OK.

  2. 在“设置”中,选择“灾难恢复” 。In Settings, select Disaster recovery.

  3. 在“配置灾难恢复” > “目标区域”中,选择要复制到的目标区域 。In Configure disaster recovery > Target region, select the target region to which you'll replicate.

  4. 对于本教程,接受其他默认设置。For this tutorial, accept the other default settings.

  5. 选择“启用复制” 。Select Enable replication. 此步骤将启动用于为 VM 启用复制的作业。This step starts a job to enable replication for the VM.

    启用复制

移动Move

以下步骤演示如何执行移动到目标区域。The following steps shows how to perform the move to the target region.

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

  2. 在“故障转移” 中,选择“最新” 。In Failover, select Latest.

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

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

弃用Discard

如果已检查移动的 VM 并且需要更改为故障转移点,或者想要返回到以前的点,请在“复制的项” 中,右键选择“VM”>“更改恢复点” 。In case you checked the moved VM and need to make changed to point of failover or want to go back to a previous point, in the Replicated items, right-select the VM > Change recovery point. 此步骤提供了指定其他恢复点并故障转移到该恢复点的选项。This step provides you the option to specify a different recovery point and failover to that one.

提交Commit

检查了移动的 VM 并准备好提交更改后,请在“复制的项” 中,右键选择“VM”>“提交” 。Once you have checked the moved VM and are ready to commit the change, in the Replicated items, right-select the VM > Commit. 此步骤会完成移到目标区域的过程。This step finishes the move process to the target region. 请等待提交作业完成。Wait until the commit job finishes.

清理Clean up

以下步骤将指导你完成如何清理源区域以及用于移动的相关资源。The following steps will guide you through how to clean up the source region as well as related resources that were used for the move.

对于用于移动的所有资源:For all resources that were used for the move:

  • 转到 VM。Go to the VM. 选择“禁用复制” 。Select Disable Replication. 此步骤会停止复制 VM 数据的过程。This step stops the process from copying the data for the VM.

    重要

    请务必执行此步骤,避免 Azure Site Recovery 复制产生费用。It's important to perform this step to avoid being charged for Azure Site Recovery replication.

如果不打算再次使用任何源资源,请完成以下附加步骤:If you have no plans to reuse any of the source resources, complete these additional steps:

  1. 删除在先决条件中标识的源区域中的所有相关网络资源。Delete all the relevant network resources in the source region that you identified in prerequisites.
  2. 删除源区域中的相应存储帐户。Delete the corresponding storage account in the source region.

后续步骤Next steps

在本教程中,你将 Azure VM 移动到了一个不同的 Azure 区域。In this tutorial, you moved an Azure VM to a different Azure region. 现在,你可以为移动的 VM 配置灾难恢复。Now you can configure disaster recovery for the VM that you moved.