教程:将 Azure VM 故障转移到次要区域Tutorial: Fail over Azure VMs to a secondary region

了解如何使用 Azure Site Recovery 将启用了灾难恢复的 Azure VM 故障转移到次要 Azure 区域。Learn how to fail over Azure VMs that are enabled for disaster recovery with Azure Site Recovery, to a secondary Azure region. 故障转移后,请在目标区域中重新保护 VM,使这些 VM 复制回主要区域。After failover, you reprotect VMs in the target region so that they replicate back to the primary region. 在本文中,学习如何:In this article, you learn how to:

  • 检查先决条件Check prerequisites
  • 验证 VM 设置Verify VM settings
  • 运行到次要区域的故障转移Run a failover to the secondary region
  • 开始将 VM 复制回主要区域。Start replicating the VM back to the primary region.

备注

本教程介绍如何通过最少的步骤对 VM 进行故障转移。This tutorial shows you how to fail over VMs with minimal steps. 如果要使用完整设置运行故障转移,请了解 Azure VM 网络自动化故障排除If you want to run a failover with full settings, learn about Azure VM networking, automation, and troubleshooting.

先决条件Prerequisites

开始本教程之前,应完成以下操作:Before you start this tutorial, you should have:

  1. 为一个或多个 Azure VM 设置复制。Set up replication for one or more Azure VMs. 如果尚未执行此操作,请完成本教程系列中的第一个教程If you haven't, complete the first tutorial in this series to do that.
  2. 建议为复制的 VM 运行灾难恢复演练We recommend you run a disaster recovery drill for replicated VMs. 在运行完整的故障转移之前运行演练有助于确保一切按预期运行,而不会影响生产环境。Running a drill before you run a full failover helps ensure everything works as expected, without impacting your production environment.

验证 VM 设置Verify the VM settings

  1. 在保管库中 >“复制的项”,选择 VM 。In the vault > Replicated items, select the VM.

    在概述页上打开 VM 属性的选项

  2. 运行故障转移之前,请在 VM“概述”页面上检查 VM 是否受保护且运行正常。On the VM Overview page, check that the VM is protected and healthy, before you run a failover. 用于验证 VM 属性和状态的页面

  3. 在故障转移之前,请检查:Before you fail over, check that:

运行故障转移Run a failover

  1. 在 VM“概述”页中,选择“故障转移” 。On the VM Overview page, select Failover.

    复制项的“故障转移”按钮

  2. 在“故障转移”中,选择一个恢复点。In Failover, choose a recovery point. 使用来自此恢复点的数据在目标区域中创建 Azure VM。The Azure VM in the target region is created using data from this recovery point.

    • 最新处理:使用由 Site Recovery 处理的最新恢复点。Latest processed: Uses the latest recovery point processed by Site Recovery. 将显示时间戳。The time stamp is shown. 无需费时处理数据,因此恢复时间目标 (RTO) 会较低。No time is spent processing data, so it provides a low recovery time objective (RTO).
    • 最新:处理发送到 Site Recovery 的所有数据,为每个 VM 创建恢复点,然后将其故障转移到该恢复点。Latest: Processes all the data sent to Site Recovery, to create a recovery point for each VM before failing over to it. 提供最低的恢复点目标 (RPO),因为触发故障转移时,所有数据都将复制到 Site Recovery 中。Provides the lowest recovery point objective (RPO), because all data is replicated to Site Recovery when the failover is triggered.
    • 最新的应用一致:此选项将 VM 故障转移到最新的应用一致恢复点。Latest app-consistent: This option fails over VMs to the latest app-consistent recovery point. 将显示时间戳。The time stamp is shown.
    • 自定义:故障转移到特定的恢复点。Custom: Fail over to particular recovery point. 自定义仅在对单个 VM 进行故障转移且不使用恢复计划时可用。Custom is only available when you fail over a single VM, and don't use a recovery plan.

    备注

    如果在启用复制后将磁盘添加到了 VM,则复制点将显示可用于恢复的磁盘。If you added a disk to a VM after you enabled replication, replication points shows disks available for recovery. 例如,在添加第二个磁盘之前创建的复制点会显示为“第 1 个磁盘,共 2 个”。For example, a replication point created before you added a second disk will show as "1 of 2 disks".

  3. 如果希望 Site Recovery 在开始故障转移之前尝试关闭源 VM,请选择“在开始故障转移之前关闭计算机”。Select Shut down machine before beginning failover if you want Site Recovery to try to shut down the source VMs before starting failover. 关闭有助于确保没有数据丢失。Shutdown helps to ensure no data loss. 即使关机失败,故障转移也仍会继续。Failover continues even if shutdown fails.

    “故障转移设置”页

  4. 若要启动故障转移,请选择“确定”。To start the failover, select OK.

  5. 在通知中监视故障转移。Monitor the failover in notifications.

    进度通知 成功通知

  6. 故障转移后,在目标区域中创建的 Azure VM 将显示在“虚拟机”中。After the failover, the Azure VM created in the target region appears in Virtual Machines. 请确保 VM 正在运行,且大小合适。Make sure that the VM is running, and sized appropriately. 如果要为 VM 使用不同的恢复点,请在“Essentials”页上选择“更改恢复点” 。If you want to use a different recovery point for the VM, select Change recovery point, on the Essentials page.

  7. 如果对已故障转移的 VM 感到满意,请在“概述”页上选择“提交”,以完成故障转移。When you're satisfied with the failed over VM, select Commit on the overview page, to finish the failover.

    “提交”按钮

  8. 在“提交”中,选择“确定”以确认 。In Commit, select OK to confirm. 提交会删除 Site Recovery 中 VM 的所有可用恢复点,并且你将无法更改恢复点。Commit deletes all the available recovery points for the VM in Site Recovery, and you won't be able to change the recovery point.

  9. 在通知中监视提交进度。Monitor the commit progress in notifications.

    提交进度通知 提交成功通知

  10. 在故障转移后,Site Recovery 不会清理源 VM。Site Recovery doesn't clean up the source VM after failover. 你需要手动执行此操作。You need to do that manually.

重新保护 VMReprotect the VM

故障转移后,请在次要区域中重新保护 VM,使其复制回主要区域。After failover, you reprotect the VM in the secondary region, so that it replicates back to the primary region.

  1. 在开始之前,请确保 VM“状态”为“已提交故障转移”。Make sure that VM Status is Failover committed before you start.

  2. 请检查你是否可以访问主要区域,以及你是否有权在其中创建 VM。Check that you can access the primary region is available, and that you have permissions to create VMs in it.

  3. 在 VM“概述”页中,选择“重新保护” 。On the VM Overview page, select Re-Protect.

    用于为 VM 启用重新保护的按钮。

  4. 在“重新保护”中,验证复制方向(次要区域到主要区域),并查看主要区域的目标设置。In Re-protect, verify the replication direction (secondary to primary region), and review the target settings for the primary region. 标记为“新”的资源由 Site Recovery 在重新保护操作中创建。Resources marked as new are created by Site Recovery as part of the reprotect operation.

    “重新保护设置”页

  5. 选择“确定”以开始重新保护过程。Select OK to start the reprotect process. 该过程将初始数据发送到目标位置,然后将 VM 的增量信息复制到目标。The process sends initial data to the target location, and then replicates delta information for the VMs to the target.

  6. 在通知中监视重新保护进度。Monitor reprotect progress in the notifications.

    重新保护进度通知 重新保护成功通知

后续步骤Next steps

在本教程中,你从主要区域故障转移到了次要区域,并开始将 VM 复制回主要区域。In this tutorial, you failed over from the primary region to the secondary, and started replicating VMs back to the primary region. 现在,可以从次要区域故障转移回主要区域。Now you can fail back from the secondary region to the primary.