您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

针对本地 VMware VM 设置到 Azure 的灾难恢复Set up disaster recovery to Azure for on-premises VMware VMs

本文介绍如何使用 Azure Site Recovery 服务启用本地 VMware VM 的复制,以便能够灾难恢复到 Azure。This article describes how to enable replication for on-premises VMware VMs, for disaster recovery to Azure using the Azure Site Recovery service.

本文是系列教程的第三篇文章,介绍如何为本地 VMware VM 设置到 Azure 的灾难恢复。This is the third tutorial in a series that shows you how to set up disaster recovery to Azure for on-premises VMware VMs. 在上一篇教程中,我们已准备本地 VMware 环境,以便能够灾难恢复到 Azure。In the previous tutorial, we prepared the on-premises VMware environment for disaster recovery to Azure.

本教程介绍如何执行下列操作:In this tutorial, you learn how to:

  • 设置源复制设置,以及一个本地 Site Recovery 配置服务器。Set up the source replication settings, and an on-premises Site Recovery configuration server.
  • 设置复制目标。Set up the replication target settings.
  • 创建复制策略。Create a replication policy.
  • 为 VMware VM 启用复制。Enable replication for a VMware 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 article in the How To section of the Site Recovery Table of Contents.

开始之前Before you start

完成前一篇教程:Complete the previous tutorials:

  1. 确保已设置 Azure,以便能够将本地 VMware 灾难恢复到 Azure。Make sure you've set up Azure for on-premises VMware disaster recovery to Azure.
  2. 遵循这些步骤准备本地 VMware 部署,以便能够灾难恢复到 Azure。Follow these steps to prepare your on-premises VMware deployment for disaster recovery to Azure.
  3. 在本教程中,我们介绍如何复制单个 VM。In this tutorial we show you how to replicate a single VM. 若要部署多个 VMware VM,则应使用部署规划器工具If you're deploying multiple VMware VMs you should use the Deployment Planner Tool. 详细了解此工具。Learn more about this tool.
  4. 本教程使用了多种选项,你也可以采用不同的方式:This tutorial uses a number of options you might want to do differently:
    • 本教程使用 OVA 模板创建配置服务器 VMware VM。The tutorial uses an OVA template to create the configuration server VMware VM. 如果出于某种原因无法执行此操作,请遵照这些说明手动设置配置服务器。If you can't do this for some reason, follow these instructions to set up the configuration server manually.
    • 在本教程中,Site Recovery 会自动将 MySQL 下载并安装到配置服务器。In this tutorial, Site Recovery automatically downloads and installs MySQL to the configuration server. 如果你愿意,可以改为手动设置它。If you prefer, you can set it up manually instead. 了解详细信息Learn more.

选择保护目标Select a protection goal

  1. 在“恢复服务保管库” 中,选择保管库名称。In Recovery Services vaults, select the vault name. 我们在此方案中使用 ContosoVMVaultWe're using ContosoVMVault for this scenario.
  2. 在“入门”中,选择“Site Recovery” ,In Getting Started, select Site Recovery. 然后选择“准备基础结构” 。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. 在“你的计算机是否已虚拟化”中,选择“是,带有 VMware vSphere 虚拟机监控程序” 。In Are your machines virtualized, select Yes, with VMware vSphere Hypervisor. 然后选择“确定”。 Then select OK.

设置源环境Set up the source environment

在源环境中,需要部署一台高度可用的本地计算机来托管这些本地 Site Recovery 组件:In your source environment, you need a single, highly available, on-premises machine to host these on-premises Site Recovery components:

  • 配置服务器:配置服务器在本地和 Azure 之间协调通信并管理数据复制。Configuration server: The configuration server coordinates communications between on-premises and Azure, and manages data replication.
  • 进程服务器:进程服务器充当复制网关。Process server: The process server acts as a replication gateway. 它接收复制数据,通过缓存、压缩和加密对其进行优化,然后将其发送到 Azure 中的缓存存储帐户。It receives replication data; optimizes it with caching, compression, and encryption, and sends it to a cache storage account in Azure. 进程服务器还会将移动服务代理安装在要复制的 VM 上,并在本地 VMware VM 上执行自动发现。The process server also installs the Mobility Service agent on VMs you want to replicate, and performs automatic discovery of on-premises VMware VMs.
  • 主目标服务器:主目标服务器处理从 Azure 进行故障回复期间产生的复制数据。Master target server: The master target server handles replication data during failback from Azure.

所有这些组件一起安装在称作“配置服务器”的一台本地计算机上。 All of these components are installed together on the single on-premises machines that's known as the configuration server. 默认情况下,为了实现 VMware 灾难恢复,我们会将一个高度可用的 VMware VM 设置为配置服务器。By default, for VMware disaster recovery, we set up the configuration server as a highly available VMware VM. 为此,请下载一个已准备好的开放虚拟化应用程序 (OVA) 模板,并将该模板导入 VMware 以创建该 VM。To do this, you download a prepared Open Virtualization Application (OVA) template, and import the template into VMware to create the VM.

  • 门户中提供了最新版本的配置服务器。The latest version of the configuration server is available in the portal. 也可以直接从 Microsoft 下载中心下载该服务器。You can also download it directly from the Microsoft Download Center.
  • 如果出于某种原因无法使用 OVA 模板来设置 VM,请遵照这些说明手动设置配置服务器。If for some reason you can't use an OVA template to set up a VM, follow these instructions to set up the configuration server manually.
  • 通过 OVF 模板提供的许可证是有效期为 180 天的评估许可证。The license provided with OVF template is an evaluation license valid for 180 days. 在 VM 上运行的 Windows 必须使用所需许可证进行激活。Windows running on the VM must be activated with the required license.

下载 VM 模板Download the VM template

  1. 在保管库中,转到“准备基础结构” > “源” 。In the vault, go to Prepare Infrastructure > Source.
  2. 在“准备源”中,选择“+配置服务器”。 In Prepare source, select +Configuration server.
  3. 在“添加服务器”中,检查“VMware 的配置服务器”是否已显示在“服务器类型”中 。In Add Server, check that Configuration server for VMware appears in Server type.
  4. 下载配置服务器的 OVF 模板。Download the OVF template for the configuration server.

在 VMware 中导入模板Import the template in VMware

  1. 使用 VMWare vSphere 客户端登录到 VMware vCenter 服务器或 vSphere ESXi 主机。Sign in to the VMware vCenter server or vSphere ESXi host with the VMWare vSphere Client.

  2. 在“文件”菜单中,选择“部署 OVF 模板”以启动“部署 OVF 模板”向导 。On the File menu, select Deploy OVF Template to start the Deploy OVF Template Wizard.

    OVF 模板

  3. 在“选择源”中,输入下载的 OVF 所在的位置 。On Select source, enter the location of the downloaded OVF.

  4. 在“查看详细信息”中,选择“下一步”。 On Review details, select Next.

  5. 在“选择名称和文件夹”和“选择配置”中,接受默认设置 。On Select name and folder and Select configuration, accept the default settings.

  6. 在“选择存储”中,为获得最佳性能,请在“选择虚拟磁盘格式”中选择“Thick Provision Eager Zeroed” 。On Select storage, for best performance select Thick Provision Eager Zeroed in Select virtual disk format.

  7. 在余下的向导页中,接受默认设置。On the rest of the wizard pages, accept the default settings.

  8. 在“准备完成”上,若要使用默认设置来设置 VM,请选择“部署后打开” > “完成” 。On Ready to complete, to set up the VM with the default settings, select Power on after deployment > Finish.

    提示

    若要添加其他 NIC,请清除“部署后打开” > “完成”。If you want to add an additional NIC, clear Power on after deployment > Finish. 默认情况下,模板包含单个 NIC。By default, the template contains a single NIC. 可以在部署后添加其他 NIC。You can add additional NICs after deployment.

添加其他适配器Add an additional adapter

若要将其他 NIC 添加到配置服务器,请在将服务器注册到保管库中之前添加它。If you want to add an additional NIC to the configuration server, add it before you register the server in the vault. 注册后不支持添加其他适配器。Adding additional adapters isn't supported after registration.

  1. 在 vSphere 客户端库存中,右键单击 VM 并选择“编辑设置” 。In the vSphere Client inventory, right-click the VM and select Edit Settings.
  2. 在“硬件”中,选择“添加” > “以太网适配器” 。In Hardware, select Add > Ethernet Adapter. 然后,选择“下一步” 。Then select Next.
  3. 选择适配器类型和网络。Select an adapter type and a network.
  4. 若要在打开 VM 时连接虚拟 NIC,请选择“打开时连接” 。To connect the virtual NIC when the VM is turned on, select Connect at power on. 选择“下一步” > “完成”。Select Next > Finish. 然后选择“确定”。 Then select OK.

注册配置服务器Register the configuration server

设置配置服务器后,将它注册到保管库中。After the configuration server is set up, you register it in the vault.

  1. 通过 VMWare vSphere 客户端控制台打开 VM。From the VMWare vSphere Client console, turn on the VM.
  2. VM 将启动并进入 Windows Server 2016 安装体验。The VM boots up into a Windows Server 2016 installation experience. 接受许可协议,然后输入管理员密码。Accept the license agreement, and enter an administrator password.
  3. 安装完成后,以管理员身份登录到 VM。After the installation finishes, sign in to the VM as the administrator.
  4. 首次登录时,会在数秒内启动 Azure Site Recovery 配置工具。The first time you sign in, the Azure Site Recovery Configuration Tool starts within a few seconds.
  5. 输入用于向 Site Recovery 注册配置服务器的名称。Enter a name that's used to register the configuration server with Site Recovery. 然后,选择“下一步” 。Then select Next.
  6. 该工具会检查 VM 是否能够连接到 Azure。The tool checks that the VM can connect to Azure. 建立连接后,选择“登录”以登录到 Azure 订阅 。After the connection is established, select Sign in to sign in to your Azure subscription. 使用的凭据必须有权访问配置服务器所要注册到的保管库。The credentials must have access to the vault in which you want to register the configuration server.
  7. 该工具将执行一些配置任务,然后重新启动。The tool performs some configuration tasks and then reboots.
  8. 再次登录到计算机。Sign in to the machine again. 在数秒内,配置服务器管理向导会自动启动。In a few seconds, the Configuration Server Management Wizard starts automatically.

配置设置并添加 VMware 服务器Configure settings and add the VMware server

完成配置服务器的设置和注册。Finish setting up and registering the configuration server.

  1. 在配置服务器管理向导中,选择“设置连接”。 In the configuration server management wizard, select Setup connectivity. 在下拉列表中,首先选择内置进程服务器用于发现的 NIC,将移动服务的安装推送到源计算机上,然后选择配置服务器用来与 Azure 连接的 NIC。From the dropdowns, first select the NIC that the in-built process server uses for discovery and push installation of mobility service on source machines, and then select the NIC that Configuration Server uses for connectivity with Azure. 再选择“保存” 。Then select Save. 配置后无法更改此设置。You cannot change this setting after it's configured.
  2. 在“选择恢复服务保管库”中,选择自己的 Azure 订阅以及相关的资源组和保管库 。In Select Recovery Services vault, select your Azure subscription and the relevant resource group and vault.
  3. 在“安装第三方软件”中 ,接受许可协议。In Install third-party software, accept the license agreement. 选择“下载并安装”,安装 MySQL 服务器。 Select Download and Install to install MySQL Server. 如果已将 MySQL 置于路径中,则会跳过此步骤。If you placed MySQL in the path, this step is skipped.
  4. 选择“安装 VMware PowerCLI” 。Select Install VMware PowerCLI. 执行此操作之前,请确保所有浏览器窗口已关闭。Make sure all browser windows are closed before you do this. 然后选择“继续”。 Then select Continue.
  5. 在“验证设备配置”中验证先决条件,然后继续 。In Validate appliance configuration, prerequisites are verified before you continue.
  6. 在“配置 vCenter Server/vSphere ESXi 服务器”中,输入要复制的 VM 所在的 vCenter Server 或 vSphere 主机的 FQDN 或 IP 地址 。In Configure vCenter Server/vSphere ESXi server, enter the FQDN or IP address of the vCenter server, or vSphere host, where the VMs you want to replicate are located. 输入服务器侦听的端口。Enter the port on which the server is listening. 为保管库中的 VMware 服务器输入一个可用的友好名称。Enter a friendly name to be used for the VMware server in the vault.
  7. 输入配置服务器用来连接到 VMware 服务器的用户凭据。Enter user credentials to be used by the configuration server to connect to the VMware server. 确保用户名和密码正确无误,并且属于要保护的虚拟机的 Administrators 组。Ensure that the user name and password are correct and is a part of the Administrators group of the virtual machine to be protected. Site Recovery 将使用这些凭据自动发现可复制的 VMware VM。Site Recovery uses these credentials to automatically discover VMware VMs that are available for replication. 选择“添加”,然后选择“继续”。 Select Add, and then select Continue.
  8. 在“配置虚拟机凭据”中,输入将用于在 VM 上自动安装移动服务的用户名和密码(如果已启用复制) 。In Configure virtual machine credentials, enter the user name and password that will be used to automatically install Mobility Service on VMs when replication is enabled.
    • 对于 Windows 计算机,该帐户在要复制的计算机上需有本地管理员特权。For Windows machines, the account needs local administrator privileges on the machines you want to replicate.
    • 对于 Linux,请提供根帐户的详细信息。For Linux, provide details for the root account.
  9. 选择“完成配置”以完成注册 。Select Finalize configuration to complete registration.
  10. 注册完成后,请在 Azure 门户中确认配置服务器和 VMware 服务器是否已在保管库中的“源”页上列出 。After registration finishes, in the Azure portal, verify that the configuration server and VMware server are listed on the Source page in the vault. 然后,选择“确定”以配置目标设置 。Then select OK to configure target settings.

注册配置服务器后,Site Recovery 将使用指定的设置连接到 VMware 服务器,并发现 VM。After the configuration server is registered, Site Recovery connects to VMware servers by using the specified settings, and discovers VMs.

备注

帐户名出现在门户中可能需要 15 分钟或更长时间。It can take 15 minutes or more for the account name to appear in the portal. 若要立即更新,请选择“配置服务器” > 服务器名称 > “刷新服务器”。 To update immediately, select Configuration Servers > server name > Refresh Server.

设置目标环境Set up the target environment

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

  1. 选择“准备基础结构” > “目标”。 Select Prepare infrastructure > Target. 选择要使用的 Azure 订阅。Select the Azure subscription you want to use. 我们将使用资源管理器模型。We're using a Resource Manager model.

  2. Site Recovery 会检查是否有一个或多个虚拟网络。Site Recovery checks that you have one or more virtual networks. 在此教程系列的第一个教程中设置 Azure 组件时,你应该已经有了这些。You should have these when you set up the Azure components in the first tutorial in this tutorial series.

    “目标”选项卡

创建复制策略Create a replication policy

  1. 打开 Azure 门户,选择“所有资源” 。Open the Azure portal, and select All resources.

  2. 选择恢复服务保管库(在本教程中为 ContosoVMVault)。Select the Recovery Services vault (ContosoVMVault in this tutorial).

  3. 若要创建复制策略,请选择“Site Recovery 基础结构” > “复制策略” > “+复制策略” 。To create a replication policy, select Site Recovery infrastructure > Replication Policies > +Replication Policy.

  4. 在“创建复制策略” 中,输入策略名称。In Create replication policy, enter the policy name. 我们使用 VMwareRepPolicyWe're using VMwareRepPolicy.

  5. 在“RPO 阈值” 中,使用默认值 60 分钟。In RPO threshold, use the default of 60 minutes. 此值确定创建恢复点的频率。This value defines how often recovery points are created. 如果连续复制超出此限制,将生成警报。An alert is generated if continuous replication exceeds this limit.

  6. 在“恢复点保留期”中,指定每个恢复点的保留时间。 In Recovery point retention, specify how longer each recovery point is retained. 在本教程中,我们将使用 72 小时。For this tutorial we're using 72 hours. 可以将复制的 VM 恢复到保留窗口中的任何点。Replicated VMs can be recovered to any point in a retention window.

  7. 在“应用一致性快照频率” 中,指定创建应用一致性快照的频率。In App-consistent snapshot frequency, specify how often app-consistent snapshots are created. 我们将使用默认值,即 60 分钟。We're using the default of 60 minutes. 选择“确定” 以创建策略。Select OK to create the policy.

    创建复制策略

  • 此策略自动与配置服务器关联。The policy is automatically associated with the configuration server.
  • 默认情况下会自动创建一个匹配策略,用于故障回复。A matching policy is automatically created for failback by default. 例如,如果复制策略是 rep-policy,则故障回复策略将是 rep-policy-failbackFor example, if the replication policy is rep-policy, then the failback policy is rep-policy-failback. 从 Azure 启动故障回复之前,不会使用此策略。This policy isn't used until you initiate a failback from Azure.

启用复制Enable replication

为 VM 启用复制,如下所示:Enable replication for VMs as follows:

  1. 选择“复制应用程序” > “源” 。Select Replicate application > Source.
  2. 在“源” 中选择“本地”,然后在“源位置”中选择配置服务器。 In Source, select On-premises, and select the configuration server in Source location.
  3. 在“计算机类型”中,选择“虚拟机” 。In Machine type, select Virtual Machines.
  4. 在“vCenter/vSphere 虚拟机监控程序”中选择 vSphere 主机或管理该主机的 vCenter 服务器。 In vCenter/vSphere Hypervisor, select the vSphere host, or vCenter server that manages the host.
  5. 选择进程服务器(默认安装在配置服务器 VM 上)。Select the process server (installed by default on the configuration server VM). 然后选择“确定”。 Then select OK. 每个进程服务器的运行状况状态是根据建议的限制和其他参数指示的。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.
  6. 在“目标”中,选择要创建故障转移 VM 的订阅和资源组 。In Target, select the subscription and the resource group in which you want to create the failed-over VMs. 我们将使用资源管理器部署模型。We're using the Resource Manager deployment model.
  7. 选择 Azure VM 在故障转移后创建时所要连接的 Azure 网络和子网。Select the Azure network and subnet to which Azure VMs connect when they're created after failover.
  8. 选择“立即为选定的计算机配置”,以便将网络设置应用到在其上启用了复制的所有 VM 。Select Configure now for selected machines to apply the network setting to all VMs on which you enable replication. 选择“稍后配置”以选择每个计算机的 Azure 网络。 Select Configure later to select the Azure network per machine.
  9. 在“虚拟机” > “选择虚拟机”中,选择要复制的每个虚拟机 。In Virtual Machines > Select virtual machines, select each machine you want to replicate. 只能选择可以启用复制的计算机。You can only select machines for which replication can be enabled. 然后选择“确定”。 Then select OK. 如果无法查看/选择特定的虚拟机,请详细了解如何解决此问题。If you are not able to view/select any particular virtual machine, learn more about resolving the issue.
  10. 在“属性” > “配置属性”中,选择进程服务器在计算机上自动安装移动服务时使用的帐户。 In Properties > Configure properties, select the account to be used by the process server to automatically install Mobility Service on the machine.
  11. 在“复制设置” > “配置复制设置”中,检查是否选择了正确的复制策略。 In Replication settings > Configure replication settings, verify that the correct replication policy is selected.
  12. 选择“启用复制”。 Select Enable Replication. 为 VM 启用复制后,Site Recovery 会安装移动服务。Site Recovery installs the Mobility Service when replication is enabled for a VM.
  13. 可以在“设置” > “作业” > “Site Recovery 作业”中,跟踪“启用保护”作业的进度。 You can track progress of the Enable Protection job in Settings > Jobs > Site Recovery Jobs. 在“完成保护” 作业运行之后,计算机就可以进行故障转移了。After the Finalize Protection job runs, the machine is ready for failover.
  14. 可能要等 15 分钟或更长时间,更改才会生效并显示在门户中。It can take 15 minutes or longer for changes to take effect and appear in the portal.
  15. 若要监视添加的 VM,请在“配置服务器” > “上次联系时间”中查看上次发现 VM 的时间。To monitor VMs you add, check the last discovered time for VMs in Configuration Servers > Last Contact At. 若要添加 VM 而不想要等待计划的发现,请突出显示配置服务器(不要选择它),然后选择“刷新”。 To add VMs without waiting for the scheduled discovery, highlight the configuration server (don't select it) and select Refresh.

后续步骤Next steps

启用复制后,请运行演练以确保一切按预期进行。After enabling replication, run a drill to make sure everything's working as expected.