为 Hyper-V VM 设置到辅助本地站点的灾难恢复Set up disaster recovery for Hyper-V VMs to a secondary on-premises site

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).

本文介绍如何为 System Center Virtual Machine Manager (VMM) 云中托管的本地 Hyper-V VM 设置到辅助站点的灾难恢复。This article shows you how to set up disaster recovery to a secondary site, for on-premises Hyper-V VMs managed in System Center Virtual Machine Manager (VMM) clouds. 在本文中,学习如何:In this article, you learn how to:

  • 准备本地 VMM 服务器和 Hyper-V 主机Prepare on-premises VMM servers and Hyper-V hosts
  • 为 Site Recovery 创建恢复服务保管库Create a Recovery Services vault for Site Recovery
  • 设置源复制环境和目标复制环境。Set up the source and target replication environments.
  • 设置网络映射Set up network mapping
  • 创建复制策略Create a replication policy
  • 为虚拟机启用复制Enable replication for a VM

先决条件Prerequisites

完成本方案:To complete this scenario:

准备网络映射Prepare for network mapping

网络映射在源和目标云中的本地 VMM VM 网络之间映射。Network mapping maps between on-premises VMM VM networks in source and target clouds. 映射将执行以下操作:Mapping does the following:

  • 故障转移后,将 VM 连接到适当的目标 VM 网络。Connects VMs to appropriate target VM networks after failover.
  • 最好将副本 VM 放于目标 Hyper-V 主机服务器上。Optimally places replica VMs on target Hyper-V host servers.
  • 如果不配置网络映射,则故障转移后,副本 VM 不会连接到 VM 网络。If you don't configure network mapping, replica VMs won't be connected to a VM network after failover.

准备 VMM,如下所示:Prepare VMM as follows:

  1. 确保源服务器和目标 VMM 服务器上具有 VMM 逻辑网络Make sure you have VMM logical networks on the source and target VMM servers.
    • 源服务器上的逻辑网络应与 Hyper-V 主机所在的源云相关联。The logical network on the source server should be associated with the source cloud in which Hyper-V hosts are located.
    • 目标服务器上的逻辑网络应与目标云相关联。The logical network on the target server should be associated with the target cloud.
  2. 确保源服务器和目标 VMM 服务器上具有 VM 网络Make sure you have VM networks on the source and target VMM servers. VM 网络应链接到每个位置中的逻辑网络。VM networks should be linked to the logical network in each location.
  3. 将源 Hyper-V 主机上的 VM 连接到源 VM 网络。Connect VMs on the source Hyper-V hosts to the source VM network.

创建恢复服务保管库Create a Recovery Services vault

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

  2. 单击“创建资源” > “监视 + 管理” > “备份和站点恢复”。Click Create a resource > Monitoring + Management > Backup and Site Recovery.

  3. 在“名称”中,指定一个友好名称以标识该保管库。In Name, specify a friendly name to identify the vault. 如果有多个订阅,请选择合适的一个。If you have more than one subscription, select the appropriate one.

  4. 创建一个资源组或选择现有的资源组。Create a resource group, or select an existing one. 指定 Azure 区域。Specify an Azure region.

  5. 要从仪表板快速访问保管库,请单击“固定到仪表板” > “创建”。To quickly access the vault from the dashboard, click Pin to dashboard > Create.

    新保管库

    新保管库会显示在“仪表板” > “所有资源”中,以及“恢复服务保管库”主页面上。The new vault will appear on the Dashboard > All resources, and on the main Recovery Services vaults page.

选择保护目标Choose a protection goal

选择要复制的内容以及要复制到的位置。Select what you want to replicate and where you want to replicate to.

  1. 单击“站点恢复” > “步骤 1: 准备基础结构” > “保护目标” 。Click Site Recovery > Step 1: Prepare Infrastructure > Protection goal.
  2. 选择“到恢复站点” ,然后选择“是,使用 Hyper-V” 。Select To recovery site, and select Yes, with Hyper-V.
  3. 选择“是” ,指示将使用 VMM 管理 Hyper-V 主机。Select Yes to indicate you're using VMM to manage the Hyper-V hosts.
  4. 如果具有辅助 VMM 服务器,请选择“是” 。Select Yes if you have a secondary VMM server. 如果要在单个 VMM 服务器上的云之间部署复制,请单击“否”。If you're deploying replication between clouds on a single VMM server, click No. Then click OK.

设置源环境Set up the source environment

在 VMM 服务器上安装 Azure Site Recovery 提供程序,在保管库中发现和注册这些服务器。Install the Azure Site Recovery Provider on VMM servers, and discover and register servers in the vault.

  1. 单击“准备基础结构” > “源”。 Click Prepare Infrastructure > Source.

  2. 在“准备源” 中单击“+VMM” 以添加 VMM 服务器。In Prepare source, click + VMM to add a VMM server.

  3. 在“添加服务器”中,检查“服务器类型”中是否已显示“System Center VMM 服务器” 。In Add Server, check that System Center VMM server appears in Server type.

  4. 下载 Azure Site Recovery 提供程序安装文件。Download the Azure Site Recovery Provider installation file.

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

    设置源

  6. 在每个 VMM 服务器上安装提供程序。Install the Provider on each VMM server. 无需在 Hyper-V 主机上显式安装任何组件。You don't need to explicitly install anything on Hyper-V hosts.

安装 Azure Site Recovery 提供程序Install the Azure Site Recovery Provider

  1. 在每个 VMM 服务器上运行提供程序安装文件。Run the Provider setup file on each VMM server. 如果 VMM 部署在群集中,请如下进行首次安装:If VMM is deployed in a cluster, install for the first time as follows:

    • 在活动节点上安装提供程序,并完成安装以在保管库中注册 VMM 服务器。Install the Provider on an active node, and finish the installation to register the VMM server in the vault.
    • 然后在其他节点上安装该提供程序。Then, install the Provider on the other nodes. 所有群集节点应运行相同版本的提供程序。Cluster nodes should all run the same version of the Provider.
  2. 安装程序运行几项先决条件检查,并请求停止 VMM 服务的权限。Setup runs a few prerequisite checks, and requests permission to stop the VMM service. VMM 服务会在安装程序完成时自动重新启动。The VMM service will be restarted automatically when setup finishes. 如果在 VMM 群集上进行安装,系统会提示停止群集角色。If you install on a VMM cluster, you're prompted to stop the Cluster role.

  3. 在“Microsoft 更新” 中,可选择指定根据 Azure 更新策略安装提供程序更新。In Microsoft Update, you can opt in to specify that provider updates are installed in accordance with your Azure Update policy.

  4. 在“安装” 中接受或修改默认安装位置,然后单击“安装” 。In Installation, accept or modify the default installation location, and click Install.

  5. 安装完成后,单击“注册”,以便在保管库中注册服务器。 After installation is complete, click Register to register the server in the vault.

    安装位置

  6. 在“保管库名称” 中,验证将要在其中注册服务器的保管库的名称。In Vault name, verify the name of the vault in which the server will be registered. 单击“下一步” 。Click Next.

  7. 在“代理连接” 中,指定在 VMM 服务器上运行的提供程序如何连接到 Azure。In Proxy Connection, specify how the Provider running on the VMM server connects to Azure.

    • 可以指定提供程序是要直接连接到 Internet 还是通过代理连接。You can specify that the provider should connect directly to the internet, or via a proxy. 根据需要指定代理设置。Specify proxy settings as needed.
    • 如果使用代理,则系统将使用指定的代理凭据自动创建一个 VMM 运行方式帐户 (DRAProxyAccount)。If you use a proxy, a VMM RunAs account (DRAProxyAccount) is created automatically, using the specified proxy credentials. 对代理服务器进行配置以便该帐户可以成功通过身份验证。Configure the proxy server so that this account can authenticate successfully. 可在 VMM 控制台 >“设置” > “安全” > “运行方式帐户” 中修改运行方式帐户设置。The RunAs account settings can be modified in the VMM console > Settings > Security > Run As Accounts.
    • 重启 VMM 服务以更新更改。Restart the VMM service to update changes.
  8. 在“注册密钥”中,选择已下载并复制到 VMM 服务器的密钥 。In Registration Key, select the key that you downloaded and copied to the VMM server.

  9. 此方案与加密设置无关。The encryption setting isn't relevant in this scenario.

  10. 在“服务器名称” 中,指定一个友好名称以在保管库中标识该 VMM 服务器。In Server name, specify a friendly name to identify the VMM server in the vault. 在群集中,指定 VMM 群集角色名称。In a cluster, specify the VMM cluster role name.

  11. 在“同步云元数据”中,选择是否要同步 VMM 服务器上所有云的元数据 。In Synchronize cloud metadata, select whether you want to synchronize metadata for all clouds on the VMM server. 此操作在每台服务器上只需执行一次。This action only needs to happen once on each server. 如果不希望同步所有云,请不要选择此设置。If you don't want to synchronize all clouds, leave this setting unchecked. 可在 VMM 控制台的云属性中单独同步每个云。You can synchronize each cloud individually, in the cloud properties in the VMM console.

  12. 单击“下一步” 以完成此过程。Click Next to complete the process. 注册后,Site Recovery 将检索 VMM 服务器中的元数据。After registration, Site Recovery retrieves metadata from the VMM server. 服务器显示在保管库中的“服务器” > “VMM 服务器” 中。The server is displayed in Servers > VMM Servers in the vault.

  13. 服务器出现在保管库后,请在“源” > “准备源”中选择 VMM 服务器,并选择 Hyper-V 主机所在的云 。After the server appears in the vault, in Source > Prepare source select the VMM server, and select the cloud in which the Hyper-V host is located. Then click OK.

设置目标环境Set up the target environment

选择目标 VMM 服务器和云:Select the target VMM server and cloud:

  1. 单击“准备基础结构” > “目标”,并选择目标 VMM 服务器 。Click Prepare infrastructure > Target, and select the target VMM server.

  2. 此时会显示与 Site Recovery 同步的 VMM 云。VMM clouds that are synchronized with Site Recovery are displayed. 选择目标云。Select the target cloud.

    目标

设置复制策略Set up a replication policy

开始之前,请确保所有使用该策略的主机均具有相同的操作系统。Before you start, make sure that all hosts using the policy have the same operating system. 如果主机运行不同版本的 Windows Server,则需要多个复制策略。If hosts are running different versions of Windows Server, you need multiple replication policies.

  1. 若要创建新的复制策略,请单击“准备基础结构” > “复制设置” > “+创建和关联” 。To create a new replication policy, click Prepare infrastructure > Replication Settings > +Create and associate.

  2. 在“创建和关联策略” 中指定策略名称。In Create and associate policy, specify a policy name. 源和目标类型应为 Hyper-V 。The source and target type should be Hyper-V.

  3. 在“Hyper-V 主机版本”中,选择主机上运行的操作系统。 In Hyper-V host version, select which operating system is running on the host.

  4. 在“身份验证类型”和“身份验证端口”中,指定如何对主 Hyper-V 主机服务器和恢复 Hyper-V 主机服务器之间的流量进行身份验证。 In Authentication type and Authentication port, specify how traffic is authenticated between the primary and recovery Hyper-V host servers.

    • 除非有正常运行的 Kerberos 环境,否则请选择“证书” 。Select Certificate unless you have a working Kerberos environment. Azure Site Recovery 将为 HTTPS 身份验证自动配置证书。Azure Site Recovery will automatically configure certificates for HTTPS authentication. 无需手动执行任何操作。You don't need to do anything manually.
    • 默认情况下,端口 8083 和 8084(用于证书)在 Hyper-V 主机服务器上的 Windows 防火墙中将处于打开状态。By default, port 8083 and 8084 (for certificates) will be opened in the Windows Firewall on the Hyper-V host servers.
    • 如果你选择了“Kerberos” ,则会使用 Kerberos 票证执行主机服务器的相互身份验证。If you do select Kerberos, a Kerberos ticket will be used for mutual authentication of the host servers. Kerberos 仅适用于在 Windows Server 2012 R2 或更高版本上运行的 Hyper-V 主机服务器。Kerberos is only relevant for Hyper-V host servers running on Windows Server 2012 R2 or later.
  5. 在“复制频率” 中,指定要在初始复制后复制增量数据的频率(每隔 30 秒、5 或 15 分钟)。In Copy frequency, specify how often you want to replicate delta data after the initial replication (every 30 seconds, 5 or 15 minutes).

  6. 在“恢复点保留期” 中,指定每个恢复点的保留期时长(以小时为单位)。In Recovery point retention, specify \how long (in hours) the retention window will be for each recovery point. 复制的计算机可以恢复到某个时段内的任意时间点。Replicated machines can be recovered to any point within a window.

  7. 在“应用一致性快照频率”中,指定创建包含应用程序一致性快照的恢复点的频率(1-12 小时)。 In App-consistent snapshot frequency, specify how frequently (1-12 hours) recovery points containing application-consistent snapshots are created. Hyper-V 使用两种类型的快照:Hyper-V uses two types of snapshots:

    • 标准快照:提供整个虚拟机的增量快照。Standard snapshot: Provides an incremental snapshot of the entire virtual machine.
    • 应用一致的快照:拍摄 VM 内应用程序数据的时点快照。App-consistent snapshot: Takes a point-in-time snapshot of the application data inside the VM. 卷影复制服务 (VSS) 可确保应用在拍摄快照时处于一致状态。Volume Shadow Copy Service (VSS) ensures that apps are in a consistent state when the snapshot is taken. 启用应用程序一致性快照会影响源 VM 的应用性能。Enabling application-consistent snapshots, affects app performance on source VMs. 确保设置的值小于所配置的附加恢复点数量。Set a value that's less than the number of additional recovery points you configure.
  8. 在“数据传输压缩”中,指定是否应压缩所传输的复制数据 。In Data transfer compression, specify whether transferred replication data should be compressed.

  9. 选择“删除副本 VM”,指定禁用对源 VM 的保护时应删除副本虚拟机。 Select Delete replica VM, to specify that the replica virtual machine should be deleted if you disable protection for the source VM. 如果启用此设置,当禁用对源 VM 的保护时,将从站点恢复控制台中删除该 VM、在 VMM 控制台中删除 VMM 的站点恢复设置,并删除副本。If you enable this setting, when you disable protection for the source VM it's removed from the Site Recovery console, Site Recovery settings for the VMM are removed from the VMM console, and the replica is deleted.

  10. 如果要通过网络进行复制,请在“初始复制方法”中指定是要启动还是计划初始复制。 In Initial replication method, if you're replicating over the network, specify whether to start the initial replication or schedule it. 若要节省网络带宽,可以将它计划在非高峰时间运行。To save network bandwidth, you might want to schedule it outside your busy hours. Then click OK.

    复制策略

  11. 新策略自动与 VMM 云关联。The new policy is automatically associated with the VMM cloud. 在“复制策略”中单击“确定”。 In Replication policy, click OK.

启用复制Enable replication

  1. 单击“复制应用程序” > “源”。 Click Replicate application > Source.
  2. 在“源”中,选择 VMM 服务器和要复制的 Hyper-V 主机所在的云。 In Source, select the VMM server, and the cloud in which the Hyper-V hosts you want to replicate are located. Then click OK.
  3. 在“目标”中,确认辅助 VMM 服务器和云。 In Target, verify the secondary VMM server and cloud.
  4. 在“虚拟机”中,从列表中选择要保护的 VM。 In Virtual machines, select the VMs you want to protect from the list.

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

后续步骤Next steps

运行灾难恢复演练Run a disaster recovery drill