为 Hyper-V VM 运行故障回复Run a failback for Hyper-V VMs

本文介绍如何使用 Azure Site Recovery 对 Hyper-V VM 从本地站点故障转移到 Azure 后创建的 Azure VM 进行故障回复。This article describes how to fail back Azure VMs that were created after failover of Hyper-V VMs from an on-premises site to Azure, with Azure Site Recovery.

  • 通过运行从 Azure 到本地站点的计划故障转移,可从 Azure 故障回复 Hyper-V VM。You fail back Hyper-V VMs from Azure by running a planned failover from Azure to the on-premises site. 如果故障转移方向是从 Azure 到本地,则将其视为故障回复。If the failover direction is from Azure to on-premises, it's considered a failback.
  • 由于 Azure 是高可用性环境并且 VM 始终可用,从 Azure 进行故障回复是计划活动。Since Azure is a highly available environment and VMs are always available, failback from Azure is a planned activity. 可计划短暂的停机时间,以便工作负载可以重新开始在本地运行。You can plan for a small downtime so that workloads can start running on-premises again.
  • 计划故障回复将关闭 Azure 中的 VM,并下载最新更改。Planned failback turns off the VMs in Azure, and downloads the latest changes. 预计不会丢失任何数据。No data loss is expected.

开始之前Before you start

  1. 查看可以使用的故障回复的类型 - 原始位置恢复和备用位置恢复。Review the types of failback you can use - original location recovery and alternate location recovery.
  2. 确保 Azure VM 使用存储帐户而非托管磁盘。Ensure that the Azure VMs are using a storage account and not managed disks. 不支持使用托管磁盘故障回复复制的 Hyper-V VM。Failback of Hyper-V VMs replicated using managed disks isn't supported.
  3. 检查并确保本地 Hyper-V 主机(如果与 Site Recovery 配合使用,则为 System Center VMM 服务器)正在运行并已连接到 Azure。Check that the on-premises Hyper-V host (or System Center VMM server if you're using with Site Recovery) is running and connected to Azure.
  4. 确保 VM 的故障转移和提交已完成。Make sure that failover and commit are complete for the VMs. 无需设置任何特定的 Site Recovery 组件即可从 Azure 故障回复 Hyper-V VM。You don't need to set up any specific Site Recovery components for failback of Hyper-V VMs from Azure.
  5. 完成数据同步和启动本地 VM 所需的时间将取决于多个因素。The time needed to complete data synchronization and start the on-premises VM will depend on a number of factors. 若要加快数据下载,可将 Azure 恢复服务代理配置为使用更多线程来并行化下载。To speed up data download, you can configure the Azure Recovery Services agent to use more threads to parallelize the download. 了解详细信息Learn more.

故障回复到原始位置Fail back to the original location

若要将 Azure 中的 Hyper-V VM 故障回复到原始本地 VM,请运行从 Azure 到本地站点的计划故障转移,如下所示:To fail back Hyper-V VMs in Azure to the original on-premises VM, run a planned failover from Azure to the on-premises site as follows:

  1. 在保管库中 >“复制的项”,选择 VM 。In the vault > Replicated items, select the VM. 右键单击 VM >“计划的故障转移” 。Right-click the VM > Planned Failover. 如果要故障回复恢复计划,请选择计划名称,然后单击“故障转移” > “计划的故障转移” 。If you're failing back a recovery plan, select the plan name and click Failover > Planned Failover.

  2. 在“确认计划的故障转移”中,选择源位置和目标位置 。In Confirm Planned Failover, choose the source and target locations. 请注意故障转移方向。Note the failover direction. 如果从主要位置故障转移已按预期完成,并且所有虚拟机都位于次要位置,则本部分仅供参考。If the failover from primary worked as expected and all virtual machines are in the secondary location this is for information only.

  3. 在“数据同步”中,选择一个选项 :In Data Synchronization, select an option:

    • 在故障转移之前同步数据(仅同步增量更改) - 此选项可最大程度地减少 VM 的停机时间,因为它可在不关闭 VM 的情况下执行同步。Synchronize data before failover (synchronize delta changes only)—This option minimizes downtime for VMs as it synchronizes without shutting them down.
      • 阶段 1:生成 Azure VM 快照,并将快照复制到本地 Hyper-V 主机。Phase 1: Takes a snapshot of Azure VM and copies it to the on-premises Hyper-V host. 计算机将继续在 Azure 中运行。The machine continues running in Azure.
      • 阶段 2:关闭 Azure VM,确保其不会发生任何新的更改。Phase 2: Shuts down the Azure VM so that no new changes occur there. 将最终的增量更改集传输到本地服务器,并启动本地 VM。The final set of delta changes is transferred to the on-premises server and the on-premises VM is started.
    • 仅在故障转移期间同步数据(完整下载) - 此选项速度更快,因为我们假定磁盘的大部分内容已更改,并且不需要费时计算校验和。Synchronize data during failover only (full download)—This option is faster because we presume that most of the disk has changed, and don't want to spend time calculating checksums. 此选项不会执行任何校验和计算。This option doesn't perform any checksum calculations.
      • 此选项会执行磁盘的下载。It performs a download of the disk.
      • 如果已运行 Azure 一段时间(一个月或以上)或已删除本地 VM,我们建议使用此选项。We recommend you use this option if you've been running Azure for a while (a month or more) or if the on-premises VM is deleted.
  4. (仅限 VMM)如果为云启用了数据加密,请在“加密密钥”中选择你在 VMM 服务器上安装提供程序期间启用数据加密时颁发的证书 。For VMM only, if data encryption is enabled for the cloud, in Encryption Key, select the certificate that was issued when you enabled data encryption during Provider installation on the VMM server.

  5. 启动故障转移。Initiate the failover. 可以在“作业”选项卡上跟踪故障转移进度。You can follow the failover progress on the Jobs tab.

  6. 如果选择了在故障转移之前同步数据的选项,请在完成初始数据同步并且已准备好在 Azure 中关闭虚拟机后,单击“作业”> 作业名称 >“完成故障转移” 。If you selected the option to synchronize the data before the failover, after the initial data synchronization is complete and you're ready to shut down the virtual machines in Azure, click Jobs > job name > Complete Failover. 这样会执行以下操作:This does the following:

    • 关闭 Azure 计算机。Shuts down the Azure machine.
    • 将最新的更改传输到本地 VM。Transfers the latest changes to the on-premises VM.
    • 启动本地 VM。Starts the on-premises VM.
  7. 现在,你可登录到本地 VM 计算机,检查它是否按预期方式提供。You can now sign into the on-premises VM machine to check that it's available as expected.

  8. 虚拟机处于待提交状态。The virtual machine is in a commit pending state. 单击“提交”以提交故障转移。Click Commit to commit the failover.

  9. 若要完成故障回复,请单击“反向复制”,重新将本地 VM 复制到 Azure 。To complete the failback, click Reverse Replicate to start replicating the on-premises VM to Azure again.

故障回复到备用位置Fail back to an alternate location

故障回复到备用位置,如下所示:Fail back to an alternate location as follows:

  1. 如果要设置新硬件,请在计算机上安装支持的 Windows 版本和 Hyper-V 角色。If you're setting up new hardware, install a supported version of Windows, and the Hyper-V role on the machine.

  2. 创建与原始服务器上的名称相同的虚拟网络交换机。Create a virtual network switch with the same name that you had on the original server.

  3. 在“受保护的项” > “保护组” > “<ProtectionGroupName> -> <VirtualMachineName>”中,选择要故障回复的 VM,然后选择“计划内故障转移” 。In Protected Items > Protection Group > <ProtectionGroupName> -> <VirtualMachineName>, select the VM you want to fail back, and then select Planned Failover.

  4. 在“确认计划的故障转移”中,选择“如果本地虚拟机不存在,则创建它” 。In Confirm Planned Failovers, elect Create on-premises virtual machine if it does not exist.

  5. 在“主机名”中,选择要在其上放置 VM 的新 Hyper-V 主机服务器 。In Host Name, select the new Hyper-V host server on which you want to place the VM.

  6. 在“数据同步”中,建议选择“在故障转移之前同步数据”这一选项 。In Data Synchronization, we recommend you select the option to synchronize the data before the failover. 此选项可以最大程度地减少 VM 的停机时间,因为它可以在不关闭 VM 的情况下执行同步。This minimizes downtime for VMs as it synchronizes without shutting them down. 此选项执行以下操作:It does the following:

    • 阶段 1:生成 Azure VM 快照,并将快照复制到本地 Hyper-V 主机。Phase 1: Takes snapshot of the Azure VM and copies it to the on-premises Hyper-V host. 计算机将继续在 Azure 中运行。The machine continues running in Azure.
    • 阶段 2:关闭 Azure VM,确保其不会发生任何新的更改。Phase 2: Shuts down the Azure VM so that no new changes occur there. 最终的更改集将传输到本地服务器,本地虚拟机会启动。The final set of changes is transferred to the on-premises server and the on-premises virtual machine is started up.
  7. 单击复选标记开始故障转移(故障回复)。Click the checkmark to begin the failover (failback).

  8. 完成初始同步并准备好关闭 Azure VM 后,请单击“作业” > “<计划内故障转移作业>”>“完成故障转移” 。After the initial synchronization finishes and you're ready to shut down the Azure VM, click Jobs > <planned failover job> > Complete Failover. 这将关闭 Azure 计算机,将最新更改传输到本地 VM,并启动 VM。This shuts down the Azure machine, transfers the latest changes to the on-premises VM, and starts it.

  9. 可登录到本地 VM,验证一切是否按预期工作。You can sign into the on-premises VM to verify that everything is working as expected.

  10. 单击“提交”完成故障转移 。Click Commit to finish the failover. 提交会删除 Azure VM 及其磁盘,并准备要重新保护的本地 VM。Commit deletes the Azure VM and its disks, and prepares the on-premises VM to be protected again.

  11. 单击“反向复制”,开始将本地 VM 复制到 Azure 。Click Reverse Replicate to start replicating the on-premises VM to Azure. 仅复制在 Azure 中关闭 VM 以来发生的增量更改。Only the delta changes since the VM was turned off in Azure will be replicated.

    Note

    如果在数据同步期间中取消故障回复作业,则本地 VM 会处于损坏状态。If you cancel the failback job during data synchronization, the on-premises VM will be in a corrupted state. 这是因为数据同步将 Azure VM 磁盘中的最新数据复制到本地数据磁盘上,在同步完成之前,磁盘数据可能不处于一致状态。This is because data synchronization copies the latest data from Azure VM disks to the on-premises data disks, and until the synchronization completes, the disk data may not be in a consistent state. 如果在取消数据同步后启动本地 VM,则 VM 可能会无法启动。If the on-premises VM starts after data synchronization is canceled, it might not boot. 在这种情况下,请重新运行故障转移以完成数据同步。In this case, rerun the failover to complete data synchronization.

后续步骤Next steps

将本地 VM 复制到 Azure 后,可根据需要运行其他到 Azure 的故障转移After the on-premises VM is replicating to Azure, you can run another failover to Azure as needed.