运行从本地到 Azure 的故障转移Run a failover from on-premises to Azure

本文介绍如何在 Azure Site Recovery 中将本地计算机故障转移到 Azure。This article describes how to fail over on-premises machines to Azure in Azure Site Recovery

开始之前Before you start

  • 了解灾难恢复中的故障转移过程。Learn about the failover process in disaster recovery.
  • 如果要对多台计算机进行故障转移,请了解如何在恢复计划中聚集计算机。If you want to fail over multiple machines, learn how to gather machines together in a recovery plan.
  • 在执行完全故障转移之前,请运行灾难恢复演练,确保一切按预期运行。Before you do a full failover, run a disaster recovery drill to ensure that everything is working as expected.

准备在故障转移后进行连接Prepare to connect after failover

若要确保可连接到故障转移后创建的 Azure VM,故障转移前需要在本地执行多项操作。To make sure you can connect to the Azure VMs that are created after failover, here are a number of things you need to do on-premises before failover.

在本地为故障转移后进行连接做好准备Prepare on-premises to connect after failover

如果要在故障转移后使用 RDP/SSH 连接到 Azure VM,则故障转移前需要在本地执行多项操作。If you want to connect to Azure VMs using RDP/SSH after failover, there are a number of things you need to do on-premises before failover.

故障转移之后After failover 位置Location 操作Actions
运行 Windows 的 Azure VMAzure VM running Windows 故障转移之前的本地计算机On-premises machine before failover 若要通过 Internet 访问 Azure VM,请启用 RDP,并确保已针对“公共” 添加 TCP 和 UDP 规则,并在“Windows 防火墙” > “允许的应用” 中针对所有配置文件允许 RDP。To access the Azure VM over the internet, enable RDP, and make sure that TCP and UDP rules are added for Public, and that RDP is allowed for all profiles in Windows Firewall > Allowed Apps.

若要通过站点到站点连接访问 Azure VM,请在计算机上启用 RDP,并确保在“Windows 防火墙” -> “允许的应用和功能” 中针对“域和专用” 网络允许 RDP。To access the Azure VM over a site-to-site connection, enable RDP on the machine, and ensure that RDP is allowed in the Windows Firewall -> Allowed apps and features, for Domain and Private networks.



删除所有静态永久性路由和 WinHTTP 代理。Remove any static persistent routes and WinHTTP proxy. 确保操作系统 SAN 策略已设置为 OnlineAllMake sure the operating system SAN policy is set to OnlineAll. 了解详细信息Learn more.

在触发故障转移时,请确保 VM 上没有处于挂起状态的 Windows 更新。Make sure there are no Windows updates pending on the VM when you trigger a failover. Windows 更新可能会在故障转移时启动,在更新完成之前,无法登录到 VM。Windows update might start when you fail over, and you won't be able to log onto the VM until the update completes.
运行 Linux 的 Azure VMAzure VM running Linux 故障转移之前的本地计算机On-premises machine before failover 确保 VM 上的安全外壳服务已设置为在系统引导时自动启动。Ensure that the Secure Shell service on the VM is set to start automatically on system boot.

确保防火墙规则允许 SSH 连接。Check that firewall rules allow an SSH connection to it.

运行故障转移Run a failover

本过程介绍了如何对恢复计划运行故障转移。This procedure describes how to run a failover for a recovery plan. 如果要为单个 VM 运行故障转移,请遵循适用于 VMware VM物理服务器Hyper-V VM 的说明。If you want to run a failover for a single VM, follow the instructions for a VMware VM, a physical server, or a Hyper-V VM.

运行恢复计划故障转移,如下所示:Run the recovery plan failover as follows:

  1. 在 Site Recovery 保管库中,选择“恢复计划” > “recoveryplan_name” 。In the Site Recovery vault, select Recovery Plans > recoveryplan_name.

  2. 单击 “故障转移”Click Failover.

    故障转移

  3. 在“故障转移” > “故障转移方向”中,如果要复制到 Azure,则保留默认值 。In Failover > Failover direction, leave the default if you're replicating to Azure.

  4. 在“故障转移”中,选择要故障转移到的恢复点 。In Failover, select a Recovery Point to which to fail over.

    • 最新:使用最新的点。Latest: Use the latest point. 此时会处理发送到 Site Recovery 服务的所有数据,并为每台计算机创建一个恢复点。This processes all the data that's been sent to Site Recovery service, and creates a recovery point for each machine. 此选项提供最低 RPO(恢复点目标),因为故障转移后创建的 VM 具有触发故障转移时复制到 Site Recovery 的所有数据。This option provides the lowest RPO (Recovery Point Objective) because the VM created after failover has all the data that's been replicated to Site Recovery when the failover was triggered. 请注意,当源区域出现故障时,将无法再进行日志处理。Please note that when the source region goes down, there is no more log processing possible. 因此,必须故障转移到“最新的已处理”恢复点。So, you will have to failover to Latest Processed recovery point. 请参阅下一个要点了解详细信息。See the next point to understand more.
    • 最新处理:使用此选项可将 VM 故障转移到已由 Site Recovery 处理的最新恢复点。Latest processed: Use this option to fail over VMs to the latest recovery point already processed by Site Recovery. 你可在 VM 的“最新恢复点”中查看最新处理的恢复点。You can see the latest processed recovery point in the VM Latest Recovery Points. 此选项提供较低的 RTO,因为无需费时处理未经处理的数据This option provides a low RTO as no time is spent to processing the unprocessed data
    • 最新应用一致:使用此选项可将 VM 故障转移到已由 Site Recovery 处理的最新应用程序一致恢复点。Latest app-consistent: Use this option to fail VMs over to the latest application consistent recovery point that's been processed by Site Recovery.
    • 最新处理的多 VM:借助此选项,属于复制组的 VM 会故障转移到最新通用多 VM 一致恢复点。Latest multi-VM processed: With this option VMs that are part of a replication group failover to the latest common multi-VM consistent recovery point. 其他虚拟机会故障转移到其最新处理的恢复点。Other virtual machines fail over to their latest processed recovery point. 此选项仅可用于至少有一个 VM 已启用多 VM 一致性的恢复计划。This option is only for recovery plans that have at least one VM with multi-VM consistency enabled.
    • 最新的多 VM 应用一致:借助此选项,属于复制组的 VM 会故障转移到最新的常用多 VM 应用程序一致恢复点。Latest multi-VM app-consistent: With this option VMs that are part of a replication group fail over to the latest common multi-VM application-consistent recovery point. 其他虚拟机将故障转移到其最新的应用程序一致恢复点。Other virtual machines failover to their latest application-consistent recovery point. 仅可用于至少有一个 VM 已启用多 VM 一致性的恢复计划。Only for recovery plans that have at least one VM with multi-VM consistency enabled.
    • 自定义:不可用于恢复计划。Custom: Not available for recovery plans. 此选项仅可用于单个 VM 的故障转移。This option is only for failover of individual VMs.
  5. 如果希望 Site Recovery 在启动故障转移前关闭源 VM,请选择“在开始故障转移前关闭计算机”。Select Shut-down machine before beginning failover if you want Site Recovery shut down source VMs before starting the failover. 即使关机失败,故障转移也仍会继续。Failover continues even if shutdown fails.

    备注

    如果对 Hyper-V VM 进行故障转移,则在触发故障转移前,关机操作会尝试同步和复制尚未发送到服务的本地数据。If you fail over Hyper-V VMs, shutdown tries to synchronize and replicate the on-premises data that hasn't yet been sent to the service, before triggering the failover.

  6. 在“作业”页上跟踪故障转移进度。Follow failover progress on the Jobs page. 即使发生错误,恢复计划也会运行到完成为止。Even if errors occurs, the recovery plan runs until it is complete.

  7. 故障转移后,登录到 VM 进行验证。After the failover, sign into the VM to validate it.

  8. 如果要切换到用于故障转移的其他恢复点,请使用“更改恢复点”。If you want to switch to different recovery point to use for the failover, use Change recovery point.

  9. 准备就绪后,就可以提交故障转移。提交操作将删除该服务可用的所有恢复点。When you're ready, you can commit the failover.The Commit action deletes all the recovery points available with the service. “更改恢复点”选项将不再可用。The Change recovery point option will no longer be available.

运行计划故障转移 (Hyper-V)Run a planned failover (Hyper-V)

可为 Hyper-V VM 运行计划故障转移。You can run a planned failover for Hyper-V VMs.

  • 计划故障转移是不会丢失任何数据的故障转移选项。A planned failover is a zero data loss failover option.
  • 触发计划内故障转移时,首先会关闭源虚拟机,同步最新数据,然后再触发故障转移。When a planned failover is triggered, first the source virtual machines are shut-down, the latest data is synchronized and then a failover is triggered.
  • 可使用“计划故障转移”选项运行计划的故障转移。You run a planned failover using the Planned failover option. 它以与常规故障转移类似的方式运行。It runs in a similar way to a regular failover.

跟踪故障转移Track failovers

有多个与故障转移相关的作业。There are a number of jobs associated with failover.

故障转移

  • 先决条件检查:确保满足故障转移所需的全部条件。Prerequisites check: Ensures that all conditions required for failover are met.
  • 故障转移:处理数据,以便通过其创建 Azure VM。Failover: Processes the data so that an Azure VM can be created from it. 如果选择了最新的恢复点,则会基于发送到服务的数据创建恢复点。If you have chosen Latest recovery point, a recovery point is created from the data that's been sent to the service.
  • 开始:使用上一步中处理的数据创建 Azure VM。Start: Creates an Azure VM using the data processed in the previous step.

警告

请勿取消正在进行的故障转移:在启动故障转移前,VM 的复制已停止。Don't cancel a failover in progress: Before failover is started, replication s stopped for the VM. 如果取消正在进行的作业,故障转移会停止,但 VM 将不会开始复制。If you cancel an in-progress job, failover stops, but the VM will not start to replicate. 无法再次启动复制。Replication can't be started again.

额外的故障转移时间Extra failover time

在某些情况下,VM 故障转移需要执行中间步骤,这些步骤通常需要大约 8 到 10 分钟才能完成。In some cases, VM failover requires intermediate step that usually takes around eight to 10 minutes to complete. 以下是受此额外步骤/时间影响的计算机:These are the machines that are affected by this additional step/time:

  • 运行的移动服务版本低于 9.8 的 VMware 虚拟机。VMware virtual machines running a Mobility service version older than 9.8.
  • 物理服务器以及作为物理服务器受到保护的 Hyper-V VM。Physical servers, and Hyper-V VMs protected as physical servers.
  • VMware Linux VM。VMware Linux VMs.
  • 这些驱动程序不作为启动驱动程序出现的 VMware VM:VMware VMs on which these drivers aren't present as boot drivers:
    • storvscstorvsc
    • vmbusvmbus
    • storfltstorflt
    • intelideintelide
    • atapiatapi
  • 未启用 DHCP 的 VMware VM,无论它们使用的是 DHCP 还是静态 IP 地址。VMware VMs that don't have DHCP enabled, irrespective of whether they're using DHCP or static IP addresses.

在故障转移过程中自动执行操作Automate actions during failover

你可能希望在故障转移过程中自动执行操作。You might want to automate actions during failover. 为此,可以在恢复计划中使用脚本或 Azure 自动化 runbook。To do this, you can use scripts or Azure automation runbooks in recovery plans.

  • 了解如何创建和自定义恢复计划,包括添加脚本。Learn about creating and customizing recovery plans, including adding scripts.
  • 了解如何将 Azure 自动化 Runbook 添加到恢复计划中。Learn about adding Azure Automation runbooks to recovery plans.

故障转移后配置设置Configure settings after failover

在故障转移后保留驱动器号Retain drive letters after failover

Site Recovery 会处理驱动器号的保留。Site Recovery handles retention of drive letters. 如果要在 VM 复制期间排除磁盘,请查看其工作原理示例If you're excluding disks during VM replication, review an example of how this works.

在 Azure 中为故障转移后进行连接做好准备Prepare in Azure to connect after failover

如果要使用 RDP 或 SSH 连接到故障转移后创建的 Azure VM,请遵照表格中汇总的要求。If you want to connect to Azure VMs that are created after failover using RDP or SSH, follow the requirements summarized in the table.

故障转移Failover 位置Location 操作Actions
运行 Windows 的 Azure VMAzure VM running Windows 故障转移之后在 Azure VM 上Azure VM after failover 为 VM 添加公共 IP 地址Add a public IP address for the VM.

已故障转移的 VM(及其连接到的 Azure 子网)上的网络安全组规则需要允许与 RDP 端口建立传入连接。The network security group rules on the failed over VM (and the Azure subnet to which it is connected) need to allow incoming connections to the RDP port.

选中“启动诊断”可查看 VM 的屏幕截图。Check Boot diagnostics to verify a screenshot of the VM.

如果无法连接,请检查 VM 是否正在运行,并查看这些故障排除提示If you can't connect, check that the VM is running, and review these troubleshooting tips.
运行 Linux 的 Azure VMAzure VM running Linux 故障转移之后在 Azure VM 上Azure VM after failover 已故障转移的 VM(及其连接到的 Azure 子网)上的网络安全组规则需要允许与 SSH 端口建立传入连接。The network security group rules on the failed over VM (and the Azure subnet to which it is connected) need to allow incoming connections to the SSH port.

为 VM 添加公共 IP 地址Add a public IP address for the VM.

选中“启动诊断”可查看 VM 的屏幕截图 。Check Boot diagnostics for a screenshot of the VM.

请按照此处所述的步骤对故障转移后的任何连接问题进行故障排除。Follow the steps described here to troubleshoot any connectivity issues post failover.

设置 IP 寻址Set up IP addressing

  • 内部 IP 地址:若要在故障转移后设置 Azure VM 的内部 IP 地址,可使用以下选项:Internal IP addresses: To set the internal IP address of an Azure VM after failover, you have a couple of options:
    • 保留相同 IP 地址:可在 Azure VM 上使用与分配给本地计算机的 IP 地址相同的 IP 地址。Retain same IP address: You can use the same IP address on the Azure VM as the one allocated to the on-premises machine.
    • 使用其他 IP 地址:可为 Azure VM 使用其他 IP 地址。Use different IP address: You can use a different IP address for the Azure VM.
    • 详细了解如何设置内部 IP 地址。Learn more about setting up internal IP addresses.
  • 外部 IP 地址:可在故障转移时保留公共 IP 地址。External IP addresses: You can retain public IP addresses on failover. 必须将故障转移过程中创建的 Azure VM 分配给 Azure 区域中可用的 Azure 公共 IP 地址。Azure VMs created as part of the failover process must be assigned an Azure public IP address available in the Azure region. 可手动分配公共 IP 地址,也可通过恢复计划自动化公共 IP 地址分配过程。You can assign a public IP address either manually or by automating the process with a recovery plan. 了解详细信息Learn more.

后续步骤Next steps

故障转移后,需要重新保护才能开始将 Azure VM 复制回本地站点。After you've failed over, you need to reprotect to start replicating the Azure VMs back to the on-premises site. 复制启动并运行后,即可在准备就绪时进行本地故障回复。After replication is up and running, you can fail back on-premises when you're ready.