Hyper-V 到 Azure 的灾难恢复体系结构Hyper-V to Azure disaster recovery architecture

本文介绍使用 Azure Site Recovery 服务在本地 Hyper-V 主机与 Azure 之间对 Hyper-V 虚拟机 (VM) 进行复制、故障转移和恢复时所使用的体系结构和过程。This article describes the architecture and processes used when you replicate, fail over, and recover Hyper-V virtual machines (VMs) between on-premises Hyper-V hosts and Azure, using the Azure Site Recovery service.

可以选择在 System Center Virtual Machine Manager (VMM) 私有云中对 Hyper-V 主机进行托管。Hyper-V hosts can optionally be managed in System Center Virtual Machine Manager (VMM) private clouds.

体系结构组件 - Hyper-V(不使用 VMM)Architectural components - Hyper-V without VMM

下面的表和图提供了在 Hyper-V 主机不受 VMM 托管时用于将 Hyper-V 复制到 Azure 的组件的概要视图。The following table and graphic provide a high-level view of the components used for Hyper-V replication to Azure, when Hyper-V hosts aren't managed by VMM.

组件 Component 要求Requirement 详细信息Details
AzureAzure Azure 订阅、Azure 存储帐户和 Azure 网络。An Azure subscription, Azure storage account, and Azure network. 从本地 VM 工作负载复制的数据存储在存储帐户中。Replicated data from on-premises VM workloads is stored in the storage account. 从本地站点运行故障转移时,使用复制的工作负载数据创建 Azure VM。Azure VMs are created with the replicated workload data when failover from your on-premises site occurs.

创建 Azure VM 后,它们将连接到 Azure 虚拟网络。The Azure VMs connect to the Azure virtual network when they're created.
Hyper-VHyper-V 在 Site Recovery 部署期间,将 Hyper-V 主机和群集收集到 Hyper-V 站点。During Site Recovery deployment, you gather Hyper-V hosts and clusters into Hyper-V sites. 在每个独立 Hyper-V 主机或每个 Hyper-V 群集节点上安装 Azure Site Recovery 提供程序和恢复服务代理。You install the Azure Site Recovery Provider and Recovery Services agent on each standalone Hyper-V host, or on each Hyper-V cluster node. 提供程序通过 Internet 使用 Site Recovery 来安排复制。The Provider orchestrates replication with Site Recovery over the internet. 恢复服务代理处理数据复制。The Recovery Services agent handles data replication.

来自提供程序和代理的通信都是安全且经过加密的。Communications from both the Provider and the agent are secure and encrypted. Azure 存储中的复制数据也已加密。Replicated data in Azure storage is also encrypted.
Hyper-V VMHyper-V VMs 一个或多个在 Hyper-V 上运行的 VM。One or more VMs running on Hyper-V. 不需在 VM 上显式安装任何内容。Nothing needs to be explicitly installed on VMs.

Hyper-V 到 Azure 体系结构(不使用 VMM)Hyper-V to Azure architecture (without VMM)

此图显示了本地 Hyper-V 站点到 Azure 的体系结构(没有 VMM)。

体系结构组件 - Hyper-V(使用 VMM)Architectural components - Hyper-V with VMM

下面的表和图提供了在 Hyper-V 主机托管在 VMM 云中时用于将 Hyper-V 复制到 Azure 的组件的概要视图。The following table and graphic provide a high-level view of the components used for Hyper-V replication to Azure, when Hyper-V hosts are managed in VMM clouds.

组件 Component 要求Requirement 详细信息Details
AzureAzure Azure 订阅、Azure 存储帐户和 Azure 网络。An Azure subscription, Azure storage account, and Azure network. 从本地 VM 工作负载复制的数据存储在存储帐户中。Replicated data from on-premises VM workloads is stored in the storage account. 从本地站点运行故障转移时,使用复制的数据创建 Azure VM。Azure VMs are created with the replicated data when failover from your on-premises site occurs.

创建 Azure VM 后,它们将连接到 Azure 虚拟网络。The Azure VMs connect to the Azure virtual network when they're created.
VMM 服务器VMM server VMM 服务器上有一个或多个包含 Hyper-V 主机的云。The VMM server has one or more clouds containing Hyper-V hosts. 在 VMM 服务器上安装 Site Recovery 提供程序,以便协调通过 Site Recovery 进行的复制,并在恢复服务保管库中注册服务器。You install the Site Recovery Provider on the VMM server, to orchestrate replication with Site Recovery, and register the server in the Recovery Services vault.
Hyper-V 主机Hyper-V host 一个或多个由 VMM 管理的 Hyper-V 主机/群集。One or more Hyper-V hosts/clusters managed by VMM. 在每个 Hyper-V 主机或群集节点上安装恢复服务代理。You install the Recovery Services agent on each Hyper-V host or cluster node.
Hyper-V VMHyper-V VMs 一个或多个在 Hyper-V 主机服务器上运行的 VM。One or VMs running on a Hyper-V host server. 不需在 VM 上显式安装任何内容。Nothing needs to explicitly installed on VMs.
网络Networking 在 VMM 服务器上设置的逻辑网络和 VM 网络。Logical and VM networks set up on the VMM server. VM 网络应链接到与云关联的逻辑网络。The VM network should be linked to a logical network that's associated with the cloud. VM 网络将映射到 Azure 虚拟网络。VM networks are mapped to Azure virtual networks. 如果在故障转移后创建 Azure VM,它们会添加到已映射至 VM 网络的 Azure 网络。When Azure VMs are created after failover, they are added to the Azure network that's mapped to the VM network.

Hyper-V 到 Azure 体系结构(使用 VMM)Hyper-V to Azure architecture (with VMM)

此图显示了本地 Hyper-V 站点到 Azure 的体系结构(有 VMM)。

设置出站网络连接Set up outbound network connectivity

若要使 Site Recovery 按预期工作,需修改出站网络连接以允许环境复制。For Site Recovery to work as expected, you need to modify outbound network connectivity to allow your environment to replicate.

备注

Site Recovery 不支持使用身份验证代理来控制网络连接。Site Recovery doesn't support using an authentication proxy to control network connectivity.

URL 的出站连接Outbound connectivity for URLs

如果使用基于 URL 的防火墙代理来控制出站连接,请允许访问以下 URL:If you're using a URL-based firewall proxy to control outbound connectivity, allow access to these URLs:

名称Name Azure 中国世纪互联Azure China 21Vianet 说明Description
存储Storage *.blob.core.chinacloudapi.cn 允许将数据从 VM 写入源区域中的缓存存储帐户。Allows data to be written from the VM to the cache storage account in the source region.
Azure Active DirectoryAzure Active Directory login.chinacloudapi.cn 向 Site Recovery 服务 URL 提供授权和身份验证。Provides authorization and authentication to Site Recovery service URLs.
复制Replication *.hypervrecoverymanager.windowsazure.cn 允许 VM 与 Site Recovery 服务进行通信。Allows the VM to communicate with the Site Recovery service.
服务总线Service Bus *.servicebus.chinacloudapi.cn 允许 VM 写入 Site Recovery 监视和诊断数据。Allows the VM to write Site Recovery monitoring and diagnostics data.

复制过程Replication process

此图显示了从 Hyper-V 到 Azure 的复制过程

复制和恢复过程Replication and recovery process

启用保护Enable protection

  1. 为 Hyper-V VM 启用保护以后,就会在 Azure 门户中或本地启动“启用保护”****。After you enable protection for a Hyper-V VM, in the Azure portal or on-premises, the Enable protection starts.
  2. 该作业会检查计算机是否符合先决条件,然后调用 CreateReplicationRelationship,以使用配置的设置来设置复制。The job checks that the machine complies with prerequisites, before invoking the CreateReplicationRelationship, to set up replication with the settings you've configured.
  3. 该作业通过调用 StartReplication 方法启动初始复制,以便初始化完整的 VM 复制,然后将 VM 的虚拟磁盘发送到 Azure。The job starts initial replication by invoking the StartReplication method, to initialize a full VM replication, and send the VM's virtual disks to Azure.
  4. 可以在“作业”选项卡中监视作业。 此屏幕截图显示了“作业”选项卡上的作业列表。 “启用保护屏幕”的屏幕截图,其中包含更多详细信息。

初始数据复制Initial data replication

  1. 当触发初始复制时,系统会拍摄一个 Hyper-V VM 快照When initial replication is triggered, a Hyper-V VM snapshot snapshot is taken.
  2. VM 上的虚拟硬盘是逐一复制的,直至全部复制到 Azure 为止。Virtual hard disks on the VM are replicated one by one, until they're all copied to Azure. 该过程可能需要一些时间,具体取决于 VM 大小和网络带宽。This might take a while, depending on the VM size, and network bandwidth. 了解如何增加网络带宽。Learn how to increase network bandwidth.
  3. 如果在初始复制期间发生磁盘更改,Hyper-V 副本复制跟踪器将跟踪这些更改,并将其记录在 Hyper-V 复制日志 (.hrl) 中。If disk changes occur while initial replication is in progress, the Hyper-V Replica Replication Tracker tracks the changes as Hyper-V replication logs (.hrl). 这些日志文件位于与磁盘相同的文件夹中。These log files are located in the same folder as the disks. 每个磁盘都有一个关联的 .hrl 文件,该文件将发送到辅助存储器。Each disk has an associated .hrl file that's sent to secondary storage. 当初始复制正在进行时,快照和日志将占用磁盘资源。The snapshot and log files consume disk resources while initial replication is in progress.
  4. 当初始复制完成时,将删除 VM 快照。When the initial replication finishes, the VM snapshot is deleted.
  5. 日志中的增量磁盘更改会进行同步,并合并到父磁盘中。Delta disk changes in the log are synchronized and merged to the parent disk.

完成保护过程Finalize protection process

  1. 初始复制完成后,“在虚拟机上完成保护”作业将运行。After the initial replication finishes, the Finalize protection on the virtual machine job runs. 该作业会配置网络和其他复制后设置以便保护 VM。It configures network and other post-replication settings, so that the VM is protected.
  2. 在此阶段,可以检查 VM 设置以确保它已为故障转移做好准备。At this stage you can check the VM settings to make sure that it's ready for failover. 可针对 VM 运行灾难恢复钻取(测试故障转移)来检查它是否按预期进行故障转移。You can run a disaster recovery drill (test failover) for the VM, to check that it fails over as expected.

增量复制Delta replication

  1. 在完成初始复制后,根据复制策略开始增量复制同步。After the initial replication, delta replication begins, in accordance with the replication policy.
  2. Hyper-V 副本复制跟踪器跟踪对虚拟硬盘所做的更改,并将其另存为 .hrl 文件。The Hyper-V Replica Replication Tracker tracks changes to a virtual hard disk as .hrl files. 为复制配置的每个磁盘都有一个关联的 .hrl 文件。Each disk that's configured for replication has an associated .hrl file.
  3. 此日志会发送到客户的存储帐户。The log is sent to the customer's storage account. 当日志正处于传输到 Azure 的过程中时,主磁盘中的变更会记录到同一文件夹的另一日志文件中。When a log is in transit to Azure, the changes in the primary disk are tracked in another log file, in the same folder.
  4. 在初始复制和增量复制过程中,可以在 Azure 门户中监视 VM。During initial and delta replication, you can monitor the VM in the Azure portal.

重新同步过程Resynchronization process

  1. 如果增量复制失败且完整复制因为带宽或时间限制而需要大量开销,则会将 VM 标记为需要重新同步。If delta replication fails, and a full replication would be costly in terms of bandwidth or time, then a VM is marked for resynchronization.

    • 例如,如果 .hrl 文件达到磁盘大小的 50%,系统会将 VM 标记为重新同步。For example, if the .hrl files reach 50% of the disk size, then the VM will be marked for resynchronization.
    • 默认情况下,重新同步安排为在非工作时间自动运行。By default resynchronization is scheduled to run automatically outside office hours.
  2. 重新同步仅发送增量数据。Resynchronization sends delta data only.

    • 它通过计算源 VM 和目标 VM 的校验和,最大程度地减小发送的数据量。It minimizes the amount of data sent by computing checksums of the source and target VMs.
    • 它使用固定块区块算法,其中源文件和目标文件被分到固定区块。It uses a fixed-block chunking algorithm where source and target files are divided into fixed chunks.
    • 会针对每个区块生成校验和。Checksums for each chunk are generated. 这些校验和将进行比较,以确定源文件中的哪些区块需要应用到目标文件。These are compared to determine which blocks from the source need to be applied to the target.
  3. 重新同步完成后,应会恢复正常增量复制。After resynchronization finishes, normal delta replication should resume.

  4. 如果你不希望等待默认非工作时间的重新同步,可手动重新同步 VM。If you don't want to wait for default resynchronization outside hours, you can resynchronize a VM manually. 例如,在发生中断时。For example, if an outage occurs. 为此,请在 Azure 门户中选择“VM”>“重新同步”****。To do this, in the Azure portal, select the VM > Resynchronize.

    显示“重新同步”选项的屏幕截图。

重试过程Retry process

如果发生复制错误,会进行内置重试。If a replication error occurs, there's a built-in retry. 重试的分类依据如表中所述。Retry is classified as described in the table.

类别Category 详细信息Details
不可恢复的错误Non-recoverable errors 不尝试执行任何重试操作。No retry is attempted. VM 状态为“严重”,并且需要管理员干预。****VM status will be Critical, and administrator intervention is required.

这些错误示例包括 VHD 链断裂、副本 VM 的状态无效、网络身份验证错误、授权错误以及“找不到 VM”错误(适用于独立 Hyper-V 服务器)。Examples of these errors include a broken VHD chain, an invalid state for the replica VM, network authentication errors, authorization errors, and VM not found errors (for standalone Hyper-V servers.
可恢复的错误Recoverable errors 使用从第一次尝试开始增大重试间隔时间(1、2、4、8、10 分钟)的指数退避算法,在到达复制间隔时间后重试。Retries occur every replication interval, using an exponential back-off that increases the retry interval from the start of the first attempt by 1, 2, 4, 8, and 10 minutes. 如果错误仍然存在,则每隔 30 分钟重试一次。If an error persists, retry every 30 minutes. 其中的一些示例包括网络错误、磁盘空间不足错误和内存不足的情况。Examples of these include network errors, low disk errors, and low memory conditions.

故障转移和故障回复过程Failover and failback process

  1. 可以运行从本地 Hyper-V VM 到 Azure 的计划内或计划外故障转移。You can run a planned or unplanned failover from on-premises Hyper-V VMs to Azure. 如果运行计划的故障转移,源 VM 将关闭以确保不会丢失数据。If you run a planned failover, then source VMs are shut down to ensure no data loss. 如果无法访问主站点,则运行计划外故障转移。Run an unplanned failover if your primary site isn't accessible.
  2. 可以故障转移单个虚拟机,或者创建恢复计划来协调多个虚拟机的故障转移。You can fail over a single machine, or create recovery plans, to orchestrate failover of multiple machines.
  3. 运行故障转移。You run a failover. 故障转移的第一阶段完成后,应该会在 Azure 中看到创建的副本 VM。After the first stage of failover completes, you should be able to see the created replica VMs in Azure. 如果需要,可向 VM 分配公共 IP 地址。You can assign a public IP address to the VM if required.
  4. 然后,提交故障转移以开始从副本 Azure VM 访问工作负载。You then commit the failover, to start accessing the workload from the replica Azure VM.

在本地基础结构启动并再次运行后,即可进行故障回复。After your on-premises infrastructure is up and running again, you can fail back. 故障回复会出现在以下三个阶段:Failback occurs in three stages:

  1. 启动从 Azure 到本地站点的计划内故障转移:Kick off a planned failover from Azure to the on-premises site:

    • 最大限度减少停机时间:如果使用此选项,Site Recovery 将在故障转移之前同步数据。Minimize downtime: If you use this option Site Recovery synchronizes data before failover. 它会检查更改的数据块并将它们下载到本地站点,同时让 Azure VM 保持运行并最大限度减少停机时间。It checks for changed data blocks and downloads them to the on-premises site, while the Azure VM keeps running, minimizing downtime. 当手动指定故障转移应完成时,Azure VM 会关闭,任何最终增量更改会被复制,而故障转移将启动。When you manually specify that the failover should complete, the Azure VM is shut down, any final delta changes are copied, and the failover starts.
    • 完整下载:使用此选项可在故障转移期间同步数据。Full download: With this option data is synchronized during failover. 此选项会下载整个磁盘。This option downloads the entire disk. 该操作更快,因为不计算校验和,但停机时间会增加。It's faster because no checksums are calculated, but there's more downtime. 如果运行副本 Azure VM 已有一段时间,或者如果本地 VM 已删除,请使用此选项。Use this option if you've been running the replica Azure VMs for some time, or if the on-premises VM was deleted.
    • 创建 VM:可选择故障回复到同一 VM 或备用 VM。Create VM: You can select to fail back to the same VM or to an alternate VM. 如果 VM 尚不存在,可指定 Site Recovery 应创建 VM。You can specify that Site Recovery should create the VM if it doesn't already exist.
  2. 初始数据同步完成后,选择完成故障转移。After initial synchronization finishes, you select to complete the failover. 该操作完成后,可以登录到本地 VM 验证一切是否按预期运行。After it completes, you can log onto the on-premises VM to check everything's working as expected. 在 Azure 门户中,可以看到 Azure VM 均已停止。In the Azure portal, you can see that the Azure VMs have been stopped.

  3. 然后,完成故障转移的提交,并重新开始从本地 VM 访问工作负载。Then, you commit the failover to finish up, and start accessing the workload from the on-premises VM again.

  4. 在工作负载进行故障回复后,启用反向复制,以便本地 VM 重新复制到 Azure。After workloads have failed back, you enable reverse replication, so that the on-premises VMs replicate to Azure again.

后续步骤Next steps

按照此教程开始执行 Hyper-V 到 Azure 的复制。Follow this tutorial to get started with Hyper-V to Azure replication.