将本地计算机迁移到 AzureMigrate on-premises machines to Azure

本文将介绍如何使用 Azure Site Recovery 将本地计算机迁移到 Azure。This article describes how to migrate on-premises machines to Azure, using the Azure Site Recovery.

本教程介绍如何将本地 VM 和物理服务器迁移到 Azure。This tutorial shows you how to migrate on-premises VMs and physical servers to Azure. 学习如何:You learn how to:

  • 设置迁移的源和目标环境Set up the source and target environment for migration
  • 设置复制策略Set up a replication policy
  • 启用复制Enable replication
  • 运行测试迁移,确保一切按预期正常工作Run a test migration to make sure everything's working as expected
  • 面向 Azure 运行一次性故障转移Run a one-time failover to Azure

开始之前Before you start

不支持半虚拟化驱动程序导出的设备。Devices exported by paravirtualized drivers aren't supported.

在 Azure 中和本地做好准备Prepare Azure and on-premises

  1. 此文中所述准备好 Azure。Prepare Azure as described in this article. 虽然此文介绍的是灾难恢复的准备步骤,但这些步骤同样适用于迁移。Although this article describes preparation steps for disaster recovery, the steps are also valid for migration.
  2. 准备本地 VMware 服务器或 Hyper-V 服务器。Prepare on-premises VMware or Hyper-V servers. 如果迁移的是物理机,则不需要做任何准备。If you're migrating physical machines, you don't need to prepare anything. 只需检查支持矩阵即可。Just verify the support matrix.

选择保护目标Select a protection goal

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

  1. 单击“恢复服务保管库”> 保管库。Click Recovery Services vaults > vault.
  2. 在“资源”菜单中,依次单击“Site Recovery” > “准备基础结构” > “保护目标”。In the Resource Menu, click Site Recovery > Prepare Infrastructure > Protection goal.
  3. 在“保护目标”中,选择要迁移的内容。In Protection goal, select what you want to migrate.
    • VMware:选择“到 Azure” > “是,使用 VMWare vSphere 虚拟机监控程序”。VMware: Select To Azure > Yes, with VMWare vSphere Hypervisor.
    • 物理计算机:选择“到 Azure” > “未虚拟化/其他”。Physical machine: Select To Azure > Not virtualized/Other.
    • Hyper-V:选择“到 Azure” > “是,使用 Hyper-V”。Hyper-V: Select To Azure > Yes, with Hyper-V. 如果 Hyper-V VM 由 VMM 管理,则选择“是”。If Hyper-V VMs are managed by VMM, select Yes.

设置源环境Set up the source environment

方案Scenario 详细信息Details
VMwareVMware 设置源环境配置服务器Set up the source environment, and set up the configuration server.
物理机Physical machine 设置源环境和配置服务器。Set up the source environment and configuration server.
Hyper-VHyper-V 设置源环境Set up the source environment

为使用 System Center VMM 部署的 Hyper-V 设置源环境Set up the source environment for Hyper-V deployed with System Center VMM.

设置目标环境Set up the target environment

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

  1. 单击“准备基础结构” > “目标” ,并选择要使用的 Azure 订阅。Click Prepare infrastructure > Target, and select the Azure subscription you want to use.
  2. 指定资源管理器部署模型。Specify the Resource Manager deployment model.
  3. Site Recovery 将检查 Azure 资源。Site Recovery checks the Azure resources.
    • 如果迁移的是 VMware VM 或物理服务器,则 Site Recovery 将会验证是否提供了一个 Azure 网络,在故障转移后创建 Azure VM 时,会将该 VM 放入该网络。If you're migrating VMware VMs or physical servers, Site Recovery verifies you have an Azure network in which the Azure VMs will be located when they're created after failover.
    • 如果迁移的是 Hyper-V VM,则 Site Recovery 将会验证是否存在兼容的 Azure 存储帐户和网络。If you're migrating Hyper-V VMs, Site Recovery verifies you have a compatible Azure storage account and network.
  4. 如果迁移的是 System Center VMM 管理的 Hyper-V VM,请设置网络映射If you're migrating Hyper-V VMs managed by System Center VMM, set up network mapping.

设置复制策略Set up a replication policy

方案Scenario 详细信息Details
VMwareVMware 为 VMware VM 设置复制策略Set up a replication policy for VMware VMs.
物理机Physical machine 为物理机设置复制策略Set up a replication policy for physical machines.
Hyper-VHyper-V 设置复制策略Set up a replication policy

为使用 System Center VMM 部署的 Hyper-V 设置复制策略Set up a replication policy for Hyper-V deployed with System Center VMM.

启用复制Enable replication

方案Scenario 详细信息Details
VMwareVMware 为 VMware VM 启用复制Enable replication for VMware VMs.
物理机Physical machine 为物理机启用复制Enable replication for physical machines.
Hyper-VHyper-V 启用复制Enable replication

为使用 System Center VMM 部署的 Hyper-V 启用复制Enable replication for Hyper-V deployed with System Center VMM.

运行测试迁移Run a test migration

运行 测试故障转移 ,确保一切如预期正常运行。Run a test failover to Azure, to make sure everything's working as expected.

迁移到 AzureMigrate to Azure

为想要迁移的计算机运行故障转移。Run a failover for the machines you want to migrate.

  1. 在“受保护的项” > “复制的项”中,单击计算机 >“故障转移”。In Protected items > Replicated items click the machine > Failover.

  2. 在“故障转移”中,选择要故障转移到的“恢复点” 。In Failover select a Recovery Point to fail over to. 选择最新恢复点。Select the latest recovery point.

  3. 加密密钥设置与此方案无关。The encryption key setting isn't relevant for this scenario.

  4. 选择“在开始故障转移前关闭计算机”。Select Shut down machine before beginning failover. 在触发故障转移之前,Site Recovery 会尝试关闭虚拟机。Site Recovery will attempt to shutdown virtual machines before triggering the failover. 即使关机失败,故障转移也仍会继续。Failover continues even if shutdown fails. 可以在“作业”页上跟踪故障转移进度。 You can follow the failover progress on the Jobs page.

  5. 检查 Azure VM 是否在 Azure 中按预期显示。Check that the Azure VM appears in Azure as expected.

  6. 在“复制的项”中,右键单击 VM >“完成迁移”。In Replicated items, right-click the VM > Complete Migration. 这样会执行以下操作:This does the following:

    • 完成迁移过程,停止本地 VM 的复制,并停止 VM 的 Site Recovery 计费。Finishes the migration process, stops replication for the on-premises VM, and stops Site Recovery billing for the VM.

    • 此步骤清除复制数据。This step cleans up the replication data. 它不删除迁移的 VM。It doesn't delete the migrated VMs.



不会取消正在进行的故障转移:在故障转移开始前,VM 复制已停止。Don't cancel a failover in progress: VM replication is stopped before failover starts. 如果取消正在进行的故障转移,故障转移会停止,但 VM 将不再进行复制。If you cancel a failover in progress, failover stops, but the VM won't replicate again.

在某些情况下,故障转移需要大约八到十分钟的时间完成其他进程。In some scenarios, failover requires additional processing that takes around eight to ten minutes to complete. 你可能注意到物理服务器、VMware Linux 计算机、未启用 DHCP 服务的 VMware VM 和未安装以下启动驱动程序:storvsc、vmbus、storflt、intelide、atapi 的 VMware VM 需要更长的测试故障转移时间。You might notice longer test failover times for physical servers, VMware Linux machines, VMware VMs that don't have the DHCP service enabled, and VMware VMs that don't have the following boot drivers: storvsc, vmbus, storflt, intelide, atapi.

迁移之后After migration

在计算机迁移到 Azure 后,应当完成许多步骤。After machines are migrated to Azure, there are a number of steps you should complete.

Azure 中的迁移后步骤Post-migration steps in Azure

  • 执行任何迁移后的应用调整,例如更新数据库连接字符串和 Web 服务器配置。Perform any post-migration app tweaks, such as updating database connection strings, and web server configurations.

  • 对 Azure 中当前运行的迁移应用程序执行最终的应用程序和迁移验收测试。Perform final application and migration acceptance testing on the migrated application now running in Azure.

  • Azure VM 代理可管理 VM 与 Azure 结构控制器之间的交互。The Azure VM agent manages VM interaction with the Azure Fabric Controller. 某些 Azure 服务(例如 Azure 备份、Site Recovery 和 Azure 安全)需要 Azure VM 代理。It's required for some Azure services, such as Azure Backup, Site Recovery, and Azure Security.

    • 如果要迁移 VMware 机和物理服务器,移动服务安装程序会在 Windows 计算机上安装可用的 Azure VM 代理。If you're migrating VMware machines and physical servers, the Mobility Service installer installs available Azure VM agent on Windows machines. 在 Linux VM 上,我们建议在故障转移后安装代理。On Linux VMs, we recommend that you install the agent after failover.
    • 如果要将 Azure VM 迁移到次要区域,则在迁移之前必须在 VM 上预配 Azure VM 代理。If you're migrating Azure VMs to a secondary region, the Azure VM agent must be provisioned on the VM before the migration.
    • 如果要将 Hyper-V VM 迁移到 Azure,请在迁移后在 Azure VM 上安装 Azure VM 代理。If you're migrating Hyper-V VMs to Azure, install the Azure VM agent on the Azure VM after the migration.
  • 从 VM 中手动删除任何 Site Recovery 提供程序/代理。Manually remove any Site Recovery provider/agent from the VM. 如果迁移 VMware VM 或物理服务器,请从 VM 中卸载移动服务。If you migrate VMware VMs or physical servers, uninstall the Mobility service from the VM.

  • 为提高恢复能力,请执行以下操作:For increased resilience:

    • 使用 Azure 备份服务备份 Azure VM 以保证数据安全。Keep data secure by backing up Azure VMs using the Azure Backup service. 了解详细信息Learn more.
    • 使用 Site Recovery 将 Azure VM 复制到次要区域以保证工作负荷运行且持续可用。Keep workloads running and continuously available by replicating Azure VMs to a secondary region with Site Recovery. 了解详细信息Learn more.
  • 为提高安全性,请执行以下操作:For increased security:

本地的迁移后步骤Post-migration steps on-premises

  • 将应用流量转移到在已迁移的 Azure VM 实例上运行的应用。Move app traffic over to the app running on the migrated Azure VM instance.
  • 从本地 VM 清单中删除本地 VM。Remove the on-premises VMs from your local VM inventory.
  • 从本地备份中删除本地 VM。Remove the on-premises VMs from local backups.
  • 更新所有内部文档,以显示新的位置和 Azure VM 的 IP 地址。Update any internal documentation to show the new location and IP address of the Azure VMs.

后续步骤Next steps

在本教程中,已将本地 VM 迁移到 Azure VM。In this tutorial you migrated on-premises VMs to Azure VMs. NowNow

为 Azure VM 设置到 Azure 次要区域的灾难恢复Set up disaster recovery to a secondary Azure region for the Azure VMs.