对 Azure 设置本地 Hyper-V VM 的灾难恢复Set up disaster recovery of on-premises Hyper-V VMs to Azure

Azure Site Recovery 服务可管理和协调本地计算机和 Azure 虚拟机 (VM) 的复制、故障转移和故障回复,因而有利于灾难恢复策略。The Azure Site Recovery service contributes to your disaster-recovery strategy by managing and orchestrating replication, failover, and failback of on-premises machines and Azure virtual machines (VMs).

此教程为系列教程中的第三个教程。This is the third tutorial in a series. 本教程演示如何设置本地 Hyper-V VM 到 Azure 的灾难恢复。It shows you how to set up disaster recovery of on-premises Hyper-V VMs to Azure. 本教程适用于不由 Microsoft System Center Virtual Machine Manager (VMM) 托管的 Hyper-V VM。This tutorial applies Hyper-V VMs that are not managed by Microsoft System Center Virtual Machine Manager (VMM).

在本教程中,你将了解如何执行以下操作:In this tutorial, you learn how to:

  • 选择复制源和目标。Select your replication source and target.
  • 设置源复制坏境,包括本地 Site Recovery 组件和目标复制环境。Set up the source replication environment, including on-premises Site Recovery components and the target replication environment.
  • 创建复制策略。Create a replication policy.
  • 为 VM 启用复制。Enable replication for a VM.

备注

教程介绍了某个方案的最简单部署路径。Tutorials show you the simplest deployment path for a scenario. 它们尽可能使用默认选项,并且不显示所有可能的设置和路径。They use default options where possible, and don't show all possible settings and paths. 有关详细说明,请查看 Site Recovery 文档的“操作指南”部分所列的文章。For detailed instructions, review the articles in the How-to Guides section of the Site Recovery documentation.

开始之前Before you begin

此教程为系列教程中的第三个教程。This is the third 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

选择复制目标Select a replication goal

  1. 在 Azure 门户中,转到“恢复服务保管库”,然后选择保管库。In the Azure portal, go to Recovery Services vaults and select the vault. 在前面的教程中,我们已准备好保管库 ContosoVMVaultWe prepared the vault ContosoVMVault in the previous tutorial.

  2. 在“入门”中选择“Site Recovery”,然后选择“准备基础结构” 。In Getting Started, select Site Recovery, and then select Prepare Infrastructure.

  3. 在“保护目标” > “计算机位于何处?”中,选择“本地” 。In Protection goal > Where are your machines located?, select On-premises.

  4. 在“要将计算机复制到何处?”中,选择“复制到 Azure” 。In Where do you want to replicate your machines?, select To Azure.

  5. 在“计算机是否已虚拟化?”中,选择“是,带有 Hyper-V” 。In Are your machines virtualized?, select Yes, with Hyper-V.

  6. 在“是否要使用 System Center VMM 管理 Hyper-V 主机?”中,选择“否”。In Are you using System Center VMM to manage your Hyper-V hosts?, select No.

  7. 选择“确定”。Select OK.

    准备基础结构中的保护目标选项的屏幕截图。

确认部署规划Confirm deployment planning

  1. 在“部署规划”中,若要规划大型部署,请通过页面上的链接下载适用于 Hyper-V 的部署规划器。In Deployment planning, if you're planning a large deployment, download the Deployment Planner for Hyper-V from the link on the page. 详细了解 Hyper-V 部署规划。Learn more about Hyper-V deployment planning.

  2. 本教程不需要使用部署规划器。For this tutorial, we don't need the Deployment Planner. 在“是否已完成部署规划?”中选择“我将稍后进行”,然后选择“确定”。In Have you completed deployment planning?, select I will do it later, and then select OK.

    准备基础结构中的部署规划选项的屏幕截图。

设置源环境Set up the source environment

若要设置源环境,请创建 Hyper-V 站点,并将包含所要复制的 VM 的 Hyper-V 主机添加到该站点。To set up the source environment, you create a Hyper-V site and add to that site the Hyper-V hosts containing VMs that you want to replicate. 然后,在每个主机上下载并安装 Azure Site Recovery 提供程序和 Azure 恢复服务代理,并将 Hyper-V 站点注册到保管库中。Then, you download and install the Azure Site Recovery Provider and the Azure Recovery Services agent on each host, and register the Hyper-V site in the vault.

  1. 在“准备基础结构”下,选择“源”。Under Prepare Infrastructure, select Source.

  2. 在“准备源”中,选择“+ Hyper-V 站点” 。In Prepare source, select + Hyper-V Site.

  3. 在“创建 Hyper-V 站点”中,指定站点名称。In Create Hyper-V site, specify the site name. 我们将使用 ContosoHyperVSiteWe're using ContosoHyperVSite.

    准备基础结构中的 Hyper-V 站点选择屏幕截图。

  4. 创建站点后,在“准备源” > “步骤 1: 选择 Hyper-V 站点”中,选择创建的站点。After the site is created, in Prepare source > Step 1: Select Hyper-V site, select the site you created.

  5. 选择“+ Hyper-V 服务器”。Select + Hyper-V Server.

    准备基础结构中的 Hyper-V 服务器选择屏幕截图。

  6. 下载 Azure Site Recovery 提供程序的安装程序。Download the installer for the Azure Site Recovery Provider.

  7. 下载保管库注册密钥。Download the vault registration key. 需要使用此密钥来安装提供程序。You need this key to install the Provider. 生成的密钥有效期为 5 天。The key is valid for five days after you generate it.

    用于下载提供程序和注册密钥的选项的屏幕截图。

安装提供程序Install the Provider

将下载的安装程序文件 (AzureSiteRecoveryProvider.exe) 安装在要添加到 Hyper-V 站点的每个 Hyper-V 主机上。Install the downloaded setup file (AzureSiteRecoveryProvider.exe) on each Hyper-V host that you want to add to the Hyper-V site. 安装程序在每个 Hyper-V 主机上安装 Azure Site Recovery 提供程序和 Recovery Services 代理。Setup installs the Azure Site Recovery Provider and Recovery Services agent on each Hyper-V host.

  1. 运行安装程序文件。Run the setup file.
  2. 在“Azure Site Recovery 提供程序安装程序向导”>“Microsoft 更新”中,选择使用 Microsoft 更新检查提供程序更新。In the Azure Site Recovery Provider Setup wizard > Microsoft Update, opt in to use Microsoft Update to check for Provider updates.
  3. 在“安装”中接受提供程序和代理的默认安装位置,并选择“安装” 。In Installation, accept the default installation location for the Provider and agent, and select Install.
  4. 安装后,在“Azure Site Recovery 注册向导”>“保管库设置”中,选择“浏览”,然后在“密钥文件”中选择下载的保管库密钥文件 。After installation, in the Azure Site Recovery Registration Wizard > Vault Settings, select Browse, and in Key File, select the vault key file that you downloaded.
  5. 指定 Azure Site Recovery 订阅、保管库名称 (ContosoVMVault) 和 Hyper-V 服务器所属的 Hyper-V 站点 (ContosoHyperVSite) 。Specify the Azure Site Recovery subscription, the vault name (ContosoVMVault), and the Hyper-V site (ContosoHyperVSite) to which the Hyper-V server belongs.
  6. 在“代理设置”中,选择“在不使用代理的情况下直接连接到 Azure Site Recovery” 。In Proxy Settings, select Connect directly to Azure Site Recovery without a proxy.
  7. 在保管库中注册服务器后,在“注册”中选择“完成” 。In Registration, after the server is registered in the vault, select Finish.

Azure Site Recovery 将检索 Hyper-V 服务器中的元数据,该服务器显示在“Site Recovery 基础结构” > “Hyper-V 主机”中。Metadata from the Hyper-V server is retrieved by Azure Site Recovery, and the server is displayed in Site Recovery Infrastructure > Hyper-V Hosts. 此过程最多可能需要 30 分钟。This process can take up to 30 minutes.

在 Hyper-V 核心服务器上安装提供程序Install the Provider on a Hyper-V core server

如果运行的是 Hyper-V 核心服务器,请下载安装程序文件并执行以下操作:If you're running a Hyper-V core server, download the setup file and follow these steps:

  1. 运行以下命令,将 AzureSiteRecoveryProvider.exe 中的文件提取到本地目录:Extract the files from AzureSiteRecoveryProvider.exe to a local directory by running this command:

    AzureSiteRecoveryProvider.exe /x:. /q

  2. 运行 .\setupdr.exe /iRun .\setupdr.exe /i. 结果将记录到 %Programdata%\ASRLogs\DRASetupWizard.log。Results are logged to %Programdata%\ASRLogs\DRASetupWizard.log.

  3. 运行此命令注册服务器:Register the server by running this command:

    cd  "C:\Program Files\Microsoft Azure Site Recovery Provider\DRConfigurator.exe" /r /Friendlyname "FriendlyName of the Server" /Credentials "path to where the credential file is saved"
    

设置目标环境Set up the target environment

选择并验证目标资源:Select and verify target resources:

  1. 选择“准备基础结构” > “目标”。 Select Prepare infrastructure > Target.
  2. 选择在故障转移后要在其中创建 Azure VM 的订阅和资源组“ContosoRG”。Select the subscription and the resource group ContosoRG in which the Azure VMs will be created after failover.
  3. 选择“资源管理器”部署模型。Select the Resource Manager" deployment model.

Site Recovery 会检查是否有一个或多个兼容的 Azure 存储帐户和网络。Site Recovery checks that you have one or more compatible Azure storage accounts and networks.

设置复制策略Set up a replication policy

  1. 选择“准备基础结构” > “复制设置” > “+创建和关联”。Select Prepare infrastructure > Replication Settings > +Create and associate.

  2. 在“创建和关联策略”中指定策略名称。In Create and associate policy, specify a policy name. 我们将使用 ContosoReplicationPolicyWe're using ContosoReplicationPolicy.

  3. 本教程将保留默认设置:For this tutorial, we'll leave the default settings:

    • “复制频率”指示(完成初始复制后)复制增量数据的频率。Copy frequency indicates how often delta data (after initial replication) will replicate. 默认频率为五分钟一次。The default frequency is every five minutes.
    • “恢复点保留期”指示恢复点将保留两小时。Recovery point retention indicates that recovery points will be retained for two hours. 保护 Hyper-V 主机上托管的虚拟机时,允许的最大保留期值为 24 小时。The maximum allowed value for retention when protecting virtual machines hosted on Hyper-V hosts is 24 hours.
    • 应用一致性快照频率指示每小时创建一次包含应用一致性快照的恢复点。App-consistent snapshot frequency indicates that recovery points containing app-consistent snapshots will be created every hour.
    • “初始复制开始时间”指示初始复制会立即开始。Initial replication start time indicates that initial replication will start immediately.
  4. 创建策略后,选择“确定”。After the policy is created, select OK. 当创建新策略时,该策略自动与指定的 Hyper-V 站点关联。When you create a new policy, it's automatically associated with the specified Hyper-V site. 在本教程中为 ContosoHyperVSite。In our tutorial, that's ContosoHyperVSite.

    复制策略

启用复制Enable replication

  1. 在“复制应用程序”中,选择“源” 。In Replicate application, select Source.

  2. 在“源”中,选择“ContosoHyperVSite”站点 。In Source, select the ContosoHyperVSite site. 选择“确定”。Then, select OK.

  3. 在“目标”中验证目标 (Azure),并验证保管库订阅,然后选择“资源管理器”部署模型 。In Target, verify the target (Azure), the vault subscription, and the Resource Manager deployment model.

  4. 如果使用教程中的设置,请选择在上一教程中为复制数据创建的 contosovmsacct1910171607 存储帐户。If you're using tutorial settings, select the contosovmsacct1910171607 storage account created in the previous tutorial for replicated data. 并选择故障转移后 Azure VM 所在的 ContosoASRnet 网络。Also select the ContosoASRnet network, in which Azure VMs will be located after failover.

  5. 在“虚拟机” > “选择”中,选择要复制的 VM 。In Virtual machines > Select, select the VM that you want to replicate. 选择“确定”。Then, select OK.

    可以在“作业” > “Site Recovery 作业”中,跟踪“启用保护”操作的进度。You can track progress of the Enable Protection action in Jobs > Site Recovery jobs. “最后完成保护”作业完成后,初始复制即已完成,VM 可执行故障转移。After the Finalize Protection job finishes, the initial replication is complete, and the VM is ready for failover.

后续步骤Next steps