对复制到 Azure 的 Hyper-V VM 进行故障转移和故障回复Fail over and fail back Hyper-V VMs replicated to Azure

本教程介绍如何将 Hyper-V VM 故障转移到 Azure。This tutorial describes how to fail over a Hyper-V VM to Azure. 故障转移后,可故障回复到本地站点(若可行)。After you've failed over, you fail back to your on-premises site when it's available. 本教程介绍如何执行下列操作:In this tutorial, you learn how to:

  • 验证 Hyper-V VM 属性以检查是否符合 Azure 要求Verify the Hyper-V VM properties to check conform with Azure requirements
  • 运行到 Azure 的故障转移Run a failover to Azure
  • 从 Azure 故障回复到本地Fail back from Azure to on-premises
  • 反向复制本地 VM,使之开始再次复制到 AzureReverse replicate on-premises VMs, to start replicating to Azure again

本教程为系列教程中的第五个教程。This tutorial is the fifth tutorial in a series. 它假设你已完成前面教程中的任务。It assumes that you have already completed the tasks in the previous tutorials.

  1. 准备 AzurePrepare Azure
  2. 准备本地 Hyper-VPrepare on-premises Hyper-V
  3. Hyper-V VM 或为托管在 System Center VMM 云中的 Hyper-V VM 设置灾难恢复Set up disaster recovery for Hyper-V VMs, or for Hyper-V VMs managed in System Center VMM clouds
  4. 运行灾难恢复演练Run a disaster recovery drill

准备故障转移和故障回复Prepare for failover and failback

确保 VM 上无快照,并且本地 VM 在故障回复期间已关闭。Make sure there are no snapshots on the VM, and that the on-premises VM is turned off during failback. 这有助于确保复制期间的数据一致性。It helps ensure data consistency during replication. 在故障回复期间不要打开本地 VM。Don't turn on on-premises VM during failback.

故障转移和故障回复具有三个阶段:Failover and failback have three stages:

  1. 故障转移到 Azure:将 Hyper-V VM 从本地站点故障转移到 Azure。Failover to Azure: Failover Hyper-V VMs from the on-premises site to Azure.
  2. 故障回复到本地:在本地站点可用时,将 Azure VM 故障转移到本地站点。Failback to on-premises: Failover Azure VMs to your on-premises site when the on-premises site is available. 它开始将数据从 Azure 同步到本地,并在完成同步后,启动本地的 VM。It starts synchronizing data from Azure to on-premises and on completion, it brings up the VMs on on-premises.
  3. 反向复制本地 VM:故障回复到本地后,反向复制本地 VM,开始将其复制到 Azure。Reverse replicate on-premises VMs: After failed back to on-premises, reverse replicate the on-premises VMs to start replicating them to Azure.

验证 VM 属性Verify VM properties

在故障转移前验证 VM 属性,确保 VM 符合 Azure 要求Before failover verify the VM properties, and make sure that the VM meets with Azure requirements.

在“受保护的项”中,单击“复制的项”>“虚拟机”。In Protected Items, click Replicated Items > VM.

  1. “复制的项”窗格中具有 VM 信息、运行状况状态和最新可用恢复点的摘要。In the Replicated item pane, there's a summary of VM information, health status, and the latest available recovery points. 单击“属性”,查看详细信息。Click Properties to view more details.

  2. 在“计算和网络”中,可修改 Azure 名称、资源组、目标大小、可用性集和托管的磁盘设置In Compute and Network, you can modify the Azure name, resource group, target size, availability set, and managed disk settings.

  3. 可查看和修改网络设置,包括在运行故障转移后 Azure VM 所在的网络/子网,以及将分配给它的 IP 地址。You can view and modify network settings, including the network/subnet in which the Azure VM will be located after failover, and the IP address that will be assigned to it.

  4. 在“磁盘”中,可以查看操作系统和 VM 上数据磁盘的相关信息。In Disks, you can see information about the operating system and data disks on the VM.

故障转移到 AzureFailover to Azure

  1. 在“设置” > “复制的项”中,单击“VM”>“故障转移”。In Settings > Replicated items, click the VM > Failover.
  2. 在“故障转移”中,选择“最新”恢复点。In Failover, select the Latest recovery point.
  3. 选择“在开始故障转移前关闭计算机”。Select Shut down machine before beginning failover. 在触发故障转移之前,Site Recovery 会尝试关闭源 VM。Site Recovery attempts to do a shutdown of source VMs before triggering the failover. 即使关机失败,故障转移也仍会继续。Failover continues even if shutdown fails. 可以在“作业”页上跟踪故障转移进度。You can follow the failover progress on the Jobs page.
  4. 验证故障转移后,单击“提交”。After you verify the failover, click Commit. 这会删除所有可用的恢复点。It deletes all the available recovery points.

Warning

请勿取消正在进行的故障转移:如果取消正在进行的故障转移,故障转移会停止,但 VM 不再复制。Don't cancel a failover in progress: If you cancel in progress, failover stops, but the VM won't replicate again.

将 Azure VM 故障回复到本地并反向复制本地 VMFailback Azure VM to on-premises and reverse replicate the on-premises VM

故障回复操作基本上是从 Azure 故障转移到本地站点,在反向复制中它会开始将 VM 从本地站点复制到 Azure。Failback operation is basically a failover from Azure to the on-premises site and in reverse replicate it again starts replicating VMs from the on-premises site to Azure.

  1. 在“设置” > “复制的项”中,单击“VM”>“计划内故障转移”。In Settings > Replicated items, click the VM > Planned Failover.
  2. 在“确认计划故障转移”中,验证故障转移方向(从 Azure),并选择源和目标位置。In Confirm Planned Failover, verify the failover direction (from Azure), and select the source and target locations.
  3. 选择“在故障转移前同步数据(仅同步增量更改)”。Select Synchronize data before failover (synchronize delta changes only). 此选项可最大程度减小 VM 停机时间,因为它在不关闭 VM 的情况下进行同步操作。This option minimizes VM downtime because it synchronizes without shutting down the VM.
  4. 启动故障转移。Initiate the failover. 可以在“作业”选项卡上跟踪故障转移进度。You can follow the failover progress on the Jobs tab.
  5. 请在完成初始数据同步且准备好关闭 Azure VM 后,单击“作业”>“<计划故障转移作业名称>”>“完成故障转移”。After the initial data synchronization is done and you're ready to shut down the Azure VMs click Jobs > planned-failover-job-name > Complete Failover. 这会关闭 Azure VM,将最新更改传输到本地,并启动本地 VM。It shuts down the Azure VM, transfers the latest changes on-premises, and starts the on-premises VM.
  6. 登录到本地 VM,检查它是否按预期方式可用。Log on to the on-premises VM to check it's available as expected.
  7. 本地 VM 当前处于“等待提交”状态。The on-premises VM is now in a Commit Pending state. 单击“提交”。Click Commit. 这会删除 Azure VM 及其磁盘,并准备要进行反向复制的本地 VM。It deletes the Azure VMs and its disks, and prepares the on-premises VM for reverse replication. 若要开始将本地 VM 复制到 Azure,请启用“反向复制”。To start replicating the on-premises VM to Azure, enable Reverse Replicate. 这会触发复制自关闭 Azure VM 以来发生的增量更改。It triggers replication of delta changes that have occurred since the Azure VM was switched off.