将 Azure VM 备份到恢复服务保管库中Back up Azure VMs in a Recovery Services vault

本文介绍如何使用 Azure 备份服务将 Azure VM 备份到恢复服务保管库中。This article describes how to back up Azure VMs in a Recovery Services vault, using the Azure Backup service.

在本文中,学习如何:In this article, you learn how to:

  • 准备 Azure VM。Prepare Azure VMs.
  • 创建保管库。Create a vault.
  • 发现 VM 并配置备份策略。Discover VMs and configure a backup policy.
  • 为 Azure VM 启用备份。Enable backup for Azure VMs.
  • 运行初始备份。Run the initial backup.

备注

本文介绍如何设置保管库并选择要备份的 VM。This article describes how to set up a vault and select VMs to back up. 若要备份多个 VM,则本文的内容会有所帮助。It's useful if you want to back up multiple VMs. 或者,可以直接从 VM 设置备份单个 Azure VMAlternatively, you can back up a single Azure VM directly from the VM settings.

开始之前Before you start

此外,在某些情况下,可能需要执行以下几个操作:In addition, there are a couple of things that you might need to do in some circumstances:

  • 在 VM 上安装 VM 代理:Azure 备份通过为在计算机上运行的 Azure VM 代理安装一个扩展来备份 Azure VM。Install the VM agent on the VM: Azure Backup backs up Azure VMs by installing an extension to the Azure VM agent running on the machine. 如果 VM 是根据 Azure 市场映像创建的,则代理将安装并运行。If your VM was created from an Azure marketplace image, the agent is installed and running. 如果创建自定义 VM,或迁移本地计算机,则可能需要手动安装代理If you create a custom VM, or you migrate an on-premises machine, you might need to install the agent manually.

创建保管库Create a vault

保管库可以存储备份以及在不同时间创建的恢复点,并可以存储与备份的计算机相关联的备份策略。A vault stores backups and recovery points created over time, and stores backup policies associated with backed up machines. 按如下所述创建保管库:Create a vault as follows:

  1. 登录 Azure 门户Sign in to the Azure portal.

  2. 在“搜索”中,键入“恢复服务”。In search, type Recovery Services. 在“服务”下,单击“恢复服务保管库” 。Under Services, click Recovery Services vaults.

    搜索恢复服务保管库

  3. 在“恢复服务保管库”菜单中,单击“+添加” 。In Recovery Services vaults menu, click +Add.

    创建恢复服务保管库步骤 2

  4. 在“恢复服务保管库”中,输入一个易记名称用于标识该保管库。In Recovery Services vault, type in a friendly name to identify the vault.

    • 名称对于 Azure 订阅需要是唯一的。The name needs to be unique for the Azure subscription.
    • 该名称可以包含 2 到 50 个字符。It can contain 2 to 50 characters.
    • 名称必须以字母开头,只能包含字母、数字和连字符。It must start with a letter, and it can contain only letters, numbers, and hyphens.
  5. 选择应在其中创建保管库的 Azure 订阅、资源组和地理区域。Select the Azure subscription, resource group, and geographic region in which the vault should be created. 然后单击“创建”。Then click Create.

    • 创建保管库可能需要一段时间。It can take a while for the vault to be created.
    • 可以在门户的右上区域中监视状态通知。Monitor the status notifications in the upper-right area of the portal.

创建保管库后,它会显示在“恢复服务保管库”列表中。After the vault is created, it appears in the Recovery Services vaults list. 如果未看到创建的保管库,请选择“刷新”。If you don't see your vault, select Refresh.

备份保管库列表

备注

Azure 备份现在允许自定义由 Azure 备份服务创建的资源组名称。Azure Backup now allows customization of the resource group name created by the Azure Backup service. 有关详细信息,请参阅虚拟机的 Azure 备份资源组For more information, see Azure Backup resource group for Virtual Machines.

修改存储复制Modify storage replication

默认情况下,保管库使用异地冗余存储 (GRS)By default, vaults use geo-redundant storage (GRS).

按如下所述修改存储复制类型:Modify storage replication type as follows:

  1. 在新保管库的“设置”部分中,单击“属性” 。In the new vault, click Properties in the Settings section.

  2. 在“属性”中的“备份配置”下,单击“更新”。 In Properties, under Backup Configuration, click Update.

  3. 选择存储复制类型,然后单击“保存”。Select the storage replication type, and click Save.

    设置新保管库的存储配置

备注

保管库已设置并包含备份项后,无法修改存储复制类型。You can't modify the storage replication type after the vault is set up and contains backup items. 如果要执行此操作,则需要重新创建保管库。If you want to do this you need to recreate the vault.

应用备份策略Apply a backup policy

为保管库配置备份策略。Configure a backup policy for the vault.

  1. 在保管库的“概述”部分中,单击“+备份” 。In the vault, click +Backup in the Overview section.

    “备份”按钮

  2. 在“备份目标” > “你的工作负荷在哪里运行?”中,选择“Azure”。 In Backup Goal > Where is your workload running? select Azure. 在“要备份哪些内容?”中,选择“虚拟机” > “确定”。 In What do you want to back up? select Virtual machine > OK. 这会在保管库中注册 VM 扩展。This registers the VM extension in the vault.

    “备份”和“备份目标”窗格

  3. 在“备份策略”中,选择要与保管库关联的策略。In Backup policy, select the policy that you want to associate with the vault.

    • 默认策略每天备份一次 VM。The default policy backs up the VM once a day. 每日备份保留 30 天。The daily backups are retained for 30 days. 即时恢复快照保留两天。Instant recovery snapshots are retained for two days.

    • 如果不想使用默认策略,请选择“新建”,然后按照下一过程中所述创建自定义策略。If you don't want to use the default policy, select Create New, and create a custom policy as described in the next procedure.

      默认备份策略

  4. 在“选择虚拟机”中,选择要使用策略备份的 VM。In Select virtual machines, select the VMs you want to back up using the policy. 然后单击“确定”。Then click OK.

    • 随后将验证选定的 VM。The selected VMs are validated.

    • 只能选择与保管库位于同一区域中的 VM。You can only select VMs in the same region as the vault.

    • 只能在单个保管库中备份 VM。VMs can only be backed up in a single vault.

      “选择虚拟机”窗格

    备注

    只有与保管库位于同一区域和订阅中的 VM 可用于配置备份。Only VMs in the same region and subscription as that of the vault will be available to configure backup.

  5. 在“备份”中,单击“启用备份” 。In Backup, click Enable backup. 这会将策略部署到保管库和 VM,并在 Azure VM 上运行的 VM 代理中安装备份扩展。This deploys the policy to the vault and to the VMs, and installs the backup extension on the VM agent running on the Azure VM.

    “启用备份”按钮

启用备份后:After enabling backup:

  • 无论 VM 是否在运行,备份服务都会安装备份扩展。The Backup service installs the backup extension whether or not the VM is running.
  • 初始备份将根据备份计划运行。An initial backup will run in accordance with your backup schedule.
  • 运行备份时,请注意:When backups run, note that:
    • VM 运行时,很有可能会捕获应用程序一致性恢复点。A VM that's running have the greatest chance for capturing an application-consistent recovery point.
    • 但是,即使 VM 已关闭,也会对其进行备份。However, even if the VM is turned off it's backed up. 此类 VM 称为脱机 VM。Such a VM is known as an offline VM. 在这种情况下,恢复点将是崩溃一致性恢复点。In this case, the recovery point will be crash-consistent.
  • 若要允许备份 Azure VM,不需要显式出站连接。Explicit outbound connectivity is not required to allow backup of Azure VMs.

创建自定义策略Create a custom policy

如果选择了创建新备份策略,请填写策略设置。If you selected to create a new backup policy, fill in the policy settings.

  1. 在“策略名称”中,指定一个有意义的名称。In Policy name, specify a meaningful name.

  2. 在“备份计划”中,指定应何时进行备份。In Backup schedule, specify when backups should be taken. 可以对 Azure VM 执行每日或每周备份。You can take daily or weekly backups for Azure VMs.

  3. 在“即时还原”中,指定要在本地保留快照以进行即时还原的时间长度。In Instant Restore, specify how long you want to retain snapshots locally for instant restore.

    • 还原时,已备份的 VM 磁盘将通过网络从存储复制到恢复存储位置。When you restore, backed up VM disks are copied from storage, across the network to the recovery storage location. 使用即时还原,你可以利用在备份作业期间创建的本地存储的快照,而无需等待备份数据传输到保管库。With instant restore, you can leverage locally-stored snapshots taken during a backup job, without waiting for backup data to be transferred to the vault.
    • 可以将快照保留 1 到 5 天以进行即时还原。You can retain snapshots for instant restore for between one to five days. 默认设置是 2 天。Two days is the default setting.
  4. 在“保留范围”中,指定要保留每日或每周备份点的时间长度。In Retention range, specify how long you want to keep your daily or weekly backup points.

  5. 在“每月备份点的保留”中,指定是否要保留每日或每周备份的每月备份。In Retention of monthly backup point, specify whether you want to keep a monthly backup of your daily or weekly backups.

  6. 单击“确定”保存策略。Click OK to save the policy.

    新建备份策略

备注

Azure 备份不支持根据 Azure VM 备份的夏令时时差自动调整时钟。Azure Backup doesn't support automatic clock adjustment for daylight-saving changes for Azure VM backups. 随着时间的推移,根据需要手动修改备份策略。As time changes occur, modify backup policies manually as required.

触发初始备份Trigger the initial backup

初始备份将根据计划运行,但可以按如下所示立即运行:The initial backup will run in accordance with the schedule, but you can run it immediately as follows:

  1. 在保管库菜单中,单击“备份项”。In the vault menu, click Backup items.
  2. 在“备份项”中,单击“Azure 虚拟机”。In Backup Items, click Azure Virtual Machine.
  3. 在“备份项”列表中,单击省略号“(...)”。In the Backup Items list, click the ellipses (...).
  4. 单击“立即备份”。Click Backup now.
  5. 在“立即备份”中,使用日历控件选择应当保留恢复点的最后一天。In Backup Now, use the calendar control to select the last day that the recovery point should be retained. 然后单击“确定”。Then click OK.
  6. 监视门户通知。Monitor the portal notifications. 可以在保管库仪表板 >“备份作业” > “进行中”监视作业进度。 You can monitor the job progress in the vault dashboard > Backup Jobs > In progress. 创建初始备份可能需要一些时间,具体取决于 VM 的大小。Depending on the size of your VM, creating the initial backup may take a while.

验证备份作业状态Verify Backup job status

每个 VM 备份的备份作业详细信息包括两个阶段,先是“快照”阶段,然后是“将数据传输到保管库”阶段 。The Backup job details for each VM backup consist of two phases, the Snapshot phase followed by the Transfer data to vault phase.
“快照”阶段可保证与磁盘一起存储的恢复点的可用性以进行即时还原,并且最多可以使用 5 天,具体取决于用户配置的快照保留期。The snapshot phase guarantees the availability of a recovery point stored along with the disks for Instant Restores and are available for a maximum of five days depending on the snapshot retention configured by the user. “将数据传输到保管库”阶段会在保管库中创建恢复点以实现长期保留。Transfer data to vault creates a recovery point in the vault for long-term retention. 仅在“快照”阶段完成后,才会开始“将数据传输到保管库”阶段。Transfer data to vault only starts after the snapshot phase is completed.

备份作业状态

有两个子任务在后端运行,一个用于前端备份作业,可以按如下所示从“备份作业”详细信息边栏选项卡中将其选中 :There are two Sub Tasks running at the backend, one for front-end backup job that can be checked from the Backup Job details blade as given below:

备份作业状态

“将数据传输到保管库”阶段可能需要数天才能完成,具体取决于磁盘的大小、每个磁盘的变动率和若干其他因素。The Transfer data to vault phase can take multiple days to complete depending on the size of the disks, churn per disk and several other factors.

作业状态可能因以下情况而有所不同:Job status can vary depending on the following scenarios:

快照Snapshot 将数据传输到保管库Transfer data to vault 作业状态Job Status
已完成Completed 正在进行In progress 正在进行In progress
已完成Completed 已跳过Skipped 已完成Completed
已完成Completed 已完成Completed 已完成Completed
已完成Completed 失败Failed 已完成,但出现警告Completed with warning
失败Failed 失败Failed 失败Failed

现在借助此功能,对于同一 VM,两个备份可以并行运行,但在任一阶段(快照、将数据传输到保管库)中,只有一个子任务可以运行。Now with this capability, for the same VM, two backups can run in parallel, but in either phase (snapshot, transfer data to vault) only one sub task can be running. 因此,借助此分离功能,将避免正在进行的备份作业导致第二天的备份失败的情况。So in scenarios were a backup job in progress resulted in the next day’s backup to fail will be avoided with this decoupling functionality. 如果前一天的备份作业处于“正在进行”状态,则后一天的备份可以在跳过“将数据传输到保管库”后完成快照。Subsequent day’s backups can have snapshot completed while Transfer data to vault skipped if an earlier day’s backup job is in progress state. 在保管库中创建的增量恢复点将捕获在保管库中创建的上一个恢复点的所有变动。The incremental recovery point created in the vault will capture all the churn from the last recovery point created in the vault. 不会对用户产生任何成本影响。There is no cost impact on the user.

可选步骤Optional steps

安装 VM 代理Install the VM agent

Azure 备份通过为在计算机上运行的 Azure VM 代理安装一个扩展来备份 Azure VM。Azure Backup backs up Azure VMs by installing an extension to the Azure VM agent running on the machine. 如果 VM 是根据 Azure 市场映像创建的,则代理将安装并运行。If your VM was created from an Azure Marketplace image, the agent is installed and running. 如果创建自定义 VM,或迁移本地计算机,则可能需要手动安装代理,如下表中所示。If you create a custom VM, or you migrate an on-premises machine, you might need to install the agent manually, as summarized in the table.

VMVM 详细信息Details
WindowsWindows 1.下载并安装代理 MSI 文件。1. Download and install the agent MSI file.

2.使用管理员权限在计算机上进行安装。2. Install with admin permissions on the machine.

3.验证安装。3. Verify the installation. 在 VM 上的 C:\WindowsAzure\Packages 中,右键单击“WaAppAgent.exe” > “属性” 。In C:\WindowsAzure\Packages on the VM, right-click WaAppAgent.exe > Properties. 在“详细信息”选项卡上,“产品版本”应为 2.6.1198.718 或更高。 On the Details tab, Product Version should be 2.6.1198.718 or higher.

如果要更新代理,请确保没有备份操作正在运行,并重新安装代理If you're updating the agent, make sure that no backup operations are running, and reinstall the agent.
LinuxLinux 使用发行版的包存储库中的 RPM 或 DEB 包进行安装。Install by using an RPM or a DEB package from your distribution's package repository. 这是安装和升级 Azure Linux 代理的首选方法。This is the preferred method for installing and upgrading the Azure Linux agent. 所有认可的分发版提供商会将 Azure Linux 代理包集成到其映像和存储库。All the endorsed distribution providers integrate the Azure Linux agent package into their images and repositories. GitHub 上提供了该代理,但我们不建议从此处安装。The agent is available on GitHub, but we don't recommend installing from there.

如果要更新代理,请确保没有备份操作正在运行,并更新二进制文件。If you're updating the agent, make sure no backup operations are running, and update the binaries.

备注

Azure 备份现在支持使用 Azure 虚拟机备份解决方案进行选择性磁盘备份和还原。Azure Backup now supports selective disk backup and restore using the Azure Virtual Machine backup solution.

现在,Azure 备份支持使用虚拟机备份解决方案同时备份 VM 中的所有磁盘(操作系统和数据)。Today, Azure Backup supports backing up all the disks (Operating System and data) in a VM together using the Virtual Machine backup solution. 使用排除磁盘功能,可以选择从 VM 的多个数据磁盘中备份一个或几个数据磁盘。With exclude-disk functionality, you get an option to backup one or a few from the many data disks in a VM. 这为你的备份和还原需求提供了一种高效且具有成本效益的解决方案。This provides an efficient and cost-effective solution for your backup and restore needs. 每个恢复点都包含备份操作中包含的磁盘数据,这进一步允许你在还原操作期间从给定的恢复点还原一部分磁盘。Each recovery point contains data of the disks included in the backup operation, which further allows you to have a subset of disks restored from the given recovery point during the restore operation. 这适用于从快照和保管库还原。This applies to restore both from the snapshot and the vault.

若要注册预览版,请通过 AskAzureBackupTeam@microsoft.com 联系我们**To sign up for the preview, write to us at AskAzureBackupTeam@microsoft.com**

后续步骤Next steps