为 VMware VM 启用到 Azure 的复制Enable replication to Azure for VMware VMs

本文介绍如何启用将本地 VMware VM 复制到 Azure。This article describes how to enable replication of on-premises VMware VMs to Azure.

解决常见问题Resolve common issues

  • 每个磁盘的大小应小于 4 TB。Each disk should be smaller than 4 TB.
  • OS 磁盘应是基本磁盘而不是动态磁盘。The OS disk should be a basic disk, not a dynamic disk.
  • 对于第 2 代虚拟机/已启用 UEFI 的虚拟机,操作系统系列应是 Windows,并且启动盘应小于 300 GB。For generation 2/UEFI-enabled virtual machines, the operating system family should be Windows, and the boot disk should be smaller than 300 GB.

先决条件Prerequisites

本文假设用户具备以下条件:This article assumes that you have:

开始之前Before you start

复制 VMware 虚拟机时,请注意以下信息:When you're replicating VMware virtual machines, keep this information in mind:

  • Azure 用户帐户需要具有某些权限,才能启用新的虚拟机到 Azure 的复制。Your Azure user account needs to have certain permissions to enable replication of a new virtual machine to Azure.
  • 系统会每隔 15 分钟发现 VMware VM 一次。VMware VMs are discovered every 15 minutes. 发现之后,可能需要 15 分钟或更长时间,VM 才会出现在 Azure 门户中。It can take 15 minutes or longer for VMs to appear in the Azure portal after discovery. 同样,添加新的 vCenter 服务器或 vSphere 主机时,发现可能要花费 15 分钟或更长时间。Likewise, discovery can take 15 minutes or longer when you add a new vCenter server or vSphere host.
  • 虚拟机上的环境更改(例如 VMware 工具安装)可能需要 15 分钟或更长时间才能在门户中更新。It can take 15 minutes or longer for environment changes on the virtual machine (such as VMware tools installation) to be updated in the portal.
  • 可以检查 VMware VM 的上次发现时间:查看 vCenter 服务器/vSphere 主机的“配置服务器”页上的“上次联系时间”字段。 You can check the last-discovered time for VMware VMs: See the Last Contact At field on the Configuration Servers page for the vCenter server/vSphere host.
  • 若要添加要复制的虚拟机且不想要等待执行计划的发现完成,请突出显示配置服务器(不要单击它),然后选择“刷新”。 To add virtual machines for replication without waiting for the scheduled discovery, highlight the configuration server (but don't click it), and select Refresh.
  • 启用复制时,如果虚拟机已做好准备,进程服务器自动在其上安装 Azure Site Recovery 移动服务。When you enable replication, if the virtual machine is prepared, the process server automatically installs the Azure Site Recovery Mobility service on it.

启用复制Enable replication

在遵循本部分中的步骤之前,请注意以下信息:Before you follow the steps in this section, note the following information:

  • Azure Site Recovery 现在会将所有新复制项直接复制到托管磁盘。Azure Site Recovery now replicates directly to managed disks for all new replications. 进程服务器将复制日志写入到目标区域中的缓存存储帐户。The process server writes replication logs to a cache storage account in the target region. 这些日志用于在具有 asrseeddisk 命名约定的副本托管磁盘中创建恢复点。These logs are used to create recovery points in replica managed disks that have naming convention of asrseeddisk.
  • Az.RecoveryServices 模块 2.0.0 版及更高版本提供了对复制到托管磁盘的 PowerShell 支持Powershell support for replicating to managed disks is available from Az.RecoveryServices module version 2.0.0 onwards
  • 故障转移时,所选的恢复点将用于创建目标托管磁盘。At the time of failover, the recovery point that you select is used to create the target-managed disk.
  • 以前配置为复制到目标存储帐户的 VM 不受影响。VMs that were previously configured to replicate to target storage accounts aren't affected.
  • 只能通过表述性状态转移 (REST) API 或 Powershell 复制到新虚拟机的存储帐户。Replication to storage accounts for a new virtual machine is only available via a Representational State Transfer (REST) API and Powershell. 使用 Azure REST API 版本 2016-08-10 或 2018-01-10 复制到存储帐户。Use Azure REST API version 2016-08-10 or 2018-01-10 for replicating to storage accounts.

请按照以下步骤启用复制:Please follow below steps to Enable Replication:

  1. 转到“步骤 2: 复制应用程序” > “源”。 Go to Step 2: Replicate application > Source. 首次启用复制后,请在保管库中选择“+复制”,对其他虚拟机启用复制 。After you enable replication for the first time, select +Replicate in the vault to enable replication for additional virtual machines.

  2. 在“源” 页 >“源” 中,选择配置服务器。In the Source page > Source, select the configuration server.

  3. 对于“计算机类型”,请选择“虚拟机”或“物理机”。 For Machine type, select Virtual Machines or Physical Machines.

  4. 在“vCenter/vSphere 虚拟机监控程序”中,选择管理 vSphere 主机的 vCenter 服务器,或选择该主机 。In vCenter/vSphere Hypervisor, select the vCenter server that manages the vSphere host, or select the host. 如果要复制物理计算机,则此设置无关紧要。This setting isn't relevant if you're replicating physical computers.

  5. 选择进程服务器。Select the process server. 如果没有创建其他进程服务器,则下拉列表中将提供配置服务器的内置进程服务器。If there are no additional process servers created, inbuilt process server of configuration server will be available in the dropdown. 每个进程服务器的运行状况状态是根据建议的限制和其他参数指示的。Health status of each process server is indicated as per recommended limits and other parameters. 选择一个正常运行的进程服务器。Choose a healthy process server. 不能选择有严重错误的进程服务器。A critical process server cannot be chosen. 你可以进行故障排除并解决错误或者设置一个横向扩展进程服务器You can either troubleshoot and resolve the errors or set up a scale-out process server.

    “启用复制源”窗口

    Note

    9.24 版本开始,引入了其他警报,以增强进程服务器的运行状况警报。From 9.24 versions, additional alerts are introduced to enhance the health alerts of process server. 将 Site Recovery 组件升级到 9.24 版或更高版本,以便生成所有警报。Upgrade Site Recovery components to 9.24 versions or above for all alerts to be generated.

  6. 对于“目标”,请选择要在其中创建故障转移虚拟机的订阅和资源组。 For Target, select the subscription and resource group where you want to create the failed-over virtual machines. 选择要在 Azure 中对故障转移的 VM 使用的部署模型。Choose the deployment model that you want to use in Azure for the failed-over VMs.

  7. 选择 Azure VM 在故障转移后所要连接的 Azure 网络和子网。Select the Azure network and subnet that the Azure VMs will connect to after failover. 该网络必须位于与 Site Recovery 服务保管库相同的区域中。The network must be in the same region as the Site Recovery service vault.

    选择“立即为选定的计算机配置” ,将网络设置应用到选择保护的所有虚拟机。Select Configure now for selected machines to apply the network setting to all virtual machines that you select for protection. 选择“稍后配置” 以选择每个虚拟机的 Azure 网络。Select Configure later to select the Azure network per virtual machine. 如果没有网络,需要创建一个。If you don't have a network, you need to create one. 若要使用 Azure 资源管理器创建网络,请选择“新建”。 To create a network by using Azure Resource Manager, select Create new. 选择适用的子网,然后选择“确定” 。Select a subnet if applicable, and then select OK.

    “启用复制目标”窗口

  8. 在“虚拟机” > “选择虚拟机”中,选择要复制的每个虚拟机 。For Virtual machines > Select virtual machines, select each virtual machine that you want to replicate. 只能选择可以启用复制的虚拟机。You can only select virtual machines for which replication can be enabled. 然后选择“确定”。 Then select OK. 如果无法查看或选择任何特定的虚拟机,请参阅源计算机未在 Azure 门户中列出以解决此问题。If you can't see or select any particular virtual machine, see Source machine isn't listed in the Azure portal to resolve the issue.

    “启用复制”>“选择虚拟机”窗口

  9. 在“属性” > “配置属性”中,选择进程服务器在虚拟机上自动安装 Site Recovery 移动服务时使用的帐户 。For Properties > Configure properties, select the account that the process server uses to automatically install the Site Recovery Mobility service on the virtual machine. 此外,请根据数据变动模式选择要复制到的目标托管磁盘的类型。Also, choose the type of target managed disk to replicate to based on your data churn patterns.

  10. 默认会复制源虚拟机的所有磁盘。By default, all the disks of a source virtual machine are replicated. 若要从复制中排除磁盘,请清除不想要复制的所有磁盘对应的“包括”复选框。 To exclude disks from replication, clear the Include check box for any disks that you don't want to replicate. 然后选择“确定”。 Then select OK. 可以稍后再设置其他属性。You can set additional properties later. 详细了解如何排除磁盘Learn more about excluding disks.

    “启用复制”>“配置属性”窗口

  11. 在“复制设置” > “配置复制设置”中,检查是否选择了正确的复制策略 。At Replication settings > Configure replication settings, verify that the correct replication policy is selected. 可以在“设置” > “复制策略” > 策略名称 > “编辑设置”中修改复制策略设置。 You can modify replication policy settings at Settings > Replication policies > policy name > Edit Settings. 对策略的更改也会应用于复制的虚拟机和新虚拟机。Changes that you apply to a policy also apply to replicating and new virtual machines.

  12. 若要将虚拟机集合到一个复制组,请启用“多 VM 一致性” 。Enable Multi-VM consistency if you want to gather virtual machines into a replication group. 指定组的名称,然后选择“确定” 。Specify a name for the group, and then select OK.

    Note

    • 复制组中的虚拟机将一起复制,并在故障转移时共享崩溃一致和应用一致恢复点。Virtual machines in a replication group replicate together and have shared crash-consistent and app-consistent recovery points when they fail over.
    • 将 VM 和物理服务器集合在一起,使其镜像工作负荷。Gather VMs and physical servers together so that they mirror your workloads. 启用多 VM 一致性可能影响工作负荷性能。Enabling multi-VM consistency can affect workload performance. 仅在虚拟机正在运行相同的工作负荷并且需要一致性的情况下,才执行此操作。Do this only if the virtual machines are running the same workload, and you need consistency.

    “启用复制”窗口

  13. 选择“启用复制”。 Select Enable Replication. 可以在“设置” > “作业” > “Site Recovery 作业”中,跟踪“启用保护”作业的进度 。You can track the progress of the Enable Protection job at Settings > Jobs > Site Recovery Jobs. 在“完成保护”作业运行之后,虚拟机就可以进行故障转移了。 After the Finalize Protection job runs, the virtual machine is ready for failover.

查看和管理 VM 属性View and manage VM properties

接下来,验证源虚拟机的属性。Next, verify the properties of the source virtual machine. 请记住,Azure VM 名称需要符合 Azure 虚拟机要求Remember that the Azure VM name needs to conform with Azure virtual machine requirements.

  1. 转到“受保护的项” > “复制的项”,然后选择虚拟机 。Go to Protected items > Replicated items, and then select the virtual machine. “概要” 页显示有关 VM 设置和状态的信息。The Essentials page shows information about the VM's settings and status.

  2. 在“属性” 中,可以查看 VM 的复制和故障转移信息。In Properties, you can view replication and failover information for the VM.

  3. 在“计算和网络” > “计算属性” 中,可以更改多个 VM 属性:In Compute and Network > Compute properties, you can change multiple VM properties.

    “计算和网络属性”窗口

    • Azure VM 名称:根据需要修改名称以使其符合 Azure 要求。Azure VM name: Modify the name to meet Azure requirements, if necessary.

    • 目标 VM 大小或 VM 类型:默认 VM 大小是根据一些参数选择的,这些参数包括目标 Azure 区域中的磁盘计数、NIC 计数、CPU 核心计数、内存和可用 VM 角色大小。Target VM size or VM type: The default VM size is chosen based on a few parameters that include Disk count, NIC count, CPU core count, Memory and available VM role sizes in target Azure region. Azure Site Recovery 选取满足所有条件的第一个可用 VM 大小。Azure Site Recovery picks the first available VM size which satisfies all the criteria. 在故障转移之前,随时可以根据需要选择不同的 VM 大小。You can select a different VM size based on your needs at any time before failover. 请注意,VM 磁盘大小也取决于源磁盘大小,并且它只能在故障转移后进行更改。Note that VM disk size is also based on source disk size, and it can only be changed after failover. Windows 上的 VM 磁盘的可伸缩性和性能目标中了解磁盘大小和 IOPS 速率。Learn more about disk sizes and IOPS rates at Scalability and performance targets for VM disks on Windows.

    • 资源组:可以选择虚拟机会在故障转移后成为其中一部分的资源组Resource group: You can select a resource group, from which a virtual machine becomes a part of a post failover. 在故障转移之前,随时可以更改此设置。You can change this setting at any time before failover. 故障转移之后,如果将虚拟机迁移到其他资源组,则会中断该虚拟机的保护设置。After failover, if you migrate the virtual machine to a different resource group, the protection settings for that virtual machine break.

    • 可用性集:如果需要虚拟机在故障转移后成为某个可用性集的一部分,可以选择一个可用性集。Availability set: You can select an availability set if your virtual machine needs to be a part of a post failover. 选择可用性集时,请注意以下信息:When you select an availability set, keep the following information in mind:

      • 仅会列出属于指定资源组的可用性集。Only availability sets that belong to the specified resource group are listed.
      • 位于不同虚拟网络中的 VM 不能属于同一个可用性集。VMs that are on different virtual networks can't be a part of the same availability set.
      • 仅大小相同的虚拟机可以属于同一可用性集。Only virtual machines of the same size can be a part of an availability set.
  4. 还可以添加有关目标网络、子网和分配给 Azure VM 的 IP 地址的信息。You can also add information about the target network, subnet, and IP address that's assigned to the Azure VM.

  5. 在“磁盘”中,可以看到 VM 上将要复制的操作系统和数据磁盘。 In Disks, you can see the operating system and data disks on the VM that will be replicated.

配置网络和 IP 地址Configure networks and IP addresses

可以设置目标 IP 地址。You can set the target IP address. 如果未提供地址,故障转移的虚拟机将使用 DHCP。If you don't provide an address, the failed-over virtual machine uses DHCP. 如果设置的地址在故障转移时不可用,则故障转移不会正常工作。If you set an address that isn't available at failover, the failover doesn't work. 如果地址可用于测试故障转移网络,则可以使用同一目标 IP 地址执行测试故障转移。If the address is available in the test failover network, you can use the same target IP address for test failover.

网络适配器数目根据为目标虚拟机指定的大小来确定,如下所述:The number of network adapters is dictated by the size that you specify for the target virtual machine, as follows:

  • 如果源虚拟机上的网络适配器数小于或等于目标 VM 大小允许的适配器数,则目标虚拟机拥有与源虚拟机相同的适配器数。If the number of network adapters on the source virtual machine is less than or equal to the number of adapters that are allowed for the target VM's size, the target has the same number of adapters as the source.
  • 如果源虚拟机的适配器数大于目标 VM 大小允许的数目,则使用目标大小允许的最大数目。If the number of adapters for the source virtual machine exceeds the number that's allowed for the target VM's size, the target size maximum is used. 例如,如果源虚拟机有两个网络适配器,而目标 VM 大小支持四个,则目标虚拟机有两个适配器。For example, if a source virtual machine has two network adapters and the target VM's size supports four, the target virtual machine has two adapters. 如果源 VM 有两个适配器,但目标大小仅支持一个,则目标 VM 只有一个适配器。If the source VM has two adapters but the target size only supports one, the target VM has only one adapter.
  • 如果虚拟机有多个网络适配器,它们会全部连接到同一网络。If the virtual machine has multiple network adapters, they all connect to the same network. 另外,列表中显示的第一个适配器会成为 Azure 虚拟机中的默认网络适配器 。Also, the first adapter that's shown in the list becomes the default network adapter in the Azure virtual machine.

Azure 混合权益Azure Hybrid Benefit

Azure 软件保障客户可以使用 Azure 混合权益来节省迁移到 Azure 的 Windows Server 计算机的许可成本。Azure Software Assurance customers can use Azure Hybrid Benefit to save on licensing costs for Windows Server computers that are migrated to Azure. 该权益也适用于 Azure 灾难恢复。The benefit also applies to Azure disaster recovery. 如果符合条件,你可以在故障转移时,将该权益分配到 Azure Site Recovery 创建的虚拟机。If you're eligible, you can assign the benefit to the virtual machine that Site Recovery creates if there's a failover. 为此,请执行以下步骤:To do that, follow these steps:

  1. 转到复制的虚拟机的“计算和网络属性”。 Go to the Computer and Network properties of the replicated virtual machine.
  2. 当系统询问你是否具有可提供 Azure 混合权益的 Windows Server 许可证时,请给予回答。Answer when asked if you have a Windows Server license that makes you eligible for Azure Hybrid Benefit.
  3. 确认你具有附带软件保障的符合条件的 Windows Server 许可证,可以使用它来对在故障转移时创建的 VM 应用 Azure 混合权益。Confirm that you have an eligible Windows Server license with Software Assurance that you can use to apply the benefit to the VM that will be created at failover.
  4. 保存复制的虚拟机的设置。Save the settings for the replicated virtual machine.

深入了解 Azure 混合权益Learn more about Azure Hybrid Benefit.

后续步骤Next steps

虚拟机进入保护状态后,请尝试故障转移,检查应用程序是否显示在 Azure 中。After the virtual machine reaches a protected state, try a failover to check whether your application appears in Azure.