对块 blob 数据执行时间点还原Perform a point-in-time restore on block blob data

你可以使用时间点还原将一组或多组块 blob 还原到以前的状态。You can use point-in-time restore to restore one or more sets of block blobs to a previous state. 本文介绍如何其存储帐户启动时间点还原,以及如何执行还原操作。This article describes how to enable point-in-time restore for a storage account and how to perform a restore operation.

有关时间点还原的详细信息,请参阅块 blob 的时间点还原To learn more about point-in-time restore, see Point-in-time restore for block blobs.

注意

时间点还原仅支持对块 blob 执行还原操作。Point-in-time restore supports restoring operations on block blobs only. 无法还原对容器的操作。Operations on containers cannot be restored. 如果通过调用删除容器操作从存储帐户中删除容器,将无法使用时间点还原操作还原该容器。If you delete a container from the storage account by calling the Delete Container operation, that container cannot be restored with a restore operation. 如果要在以后还原它们,请删除单个 blob,而不是删除整个容器。Rather than deleting an entire container, delete individual blobs if you may want to restore them later.

启用和配置时间点还原Enable and configure point-in-time restore

启用和配置时间点还原之前,请先为存储帐户启用先决条件:软删除、更改源和 blob 版本控制。Before you enable and configure point-in-time restore, enable its prerequisites for the storage account: soft delete, change feed, and blob versioning. 若要详细了解如何启用上述每项功能,请参阅以下文章:For more information about enabling each of these features, see these articles:

重要

启用软删除、更改源和 blob 版本控制可能会产生额外费用。Enabling soft delete, change feed, and blob versioning may result in additional charges. 有关详细信息,请参阅 blob 的软删除Azure Blob 存储中的更改源支持Blob 版本控制For more information, see Soft delete for blobs, Change feed support in Azure Blob Storage, and Blob versioning.

目前,门户不支持, 你可以选择 PowerShell 或 Azure CLI 。It's not supported in the portal now, you can choose Azure PowerShell or CLI.

选择还原点Choose a restore point

还原点是指数据还原到的日期和时间。The restore point is the date and time to which the data is restored. Azure 存储始终使用 UTC 日期/时间值作为还原点。Azure Storage always uses a UTC date/time value as the restore point. 但通过 Azure 门户,可以按照本地时间指定还原点,然后将该日期/时间值转换为 UTC 的日期/时间值以执行还原操作。However, the Azure portal allows you to specify the restore point in local time, and then converts that date/time value to a UTC date/time value to perform the restore operation.

通过 PowerShell 或 Azure CLI 执行还原操作时,应将还原点指定为 UTC 的日期/时间值。When you perform a restore operation with PowerShell or Azure CLI, you should specify the restore point as a UTC date/time value. 如果以本地时间值而不是 UTC 的时间值指定还原点,还原操作在某些情况下可能仍会按照预期方式运行。If the restore point is specified with a local time value instead of a UTC time value, the restore operation may still behave as expected in some cases. 例如,如果本地时间为 UTC 时间减去五个时间,那么指定本地时间值会导致还原点比你提供的值早五个小时。For example, if your local time is UTC minus five hours, then specifying a local time value results in a restore point that is five hours earlier that the value that you provided. 如果在该五小时内没有对还原范围内的数据进行更改,则还原操作将产生相同结果,而不管提供的时间值是多少。If no changes were made to the data in the range to be restored during that five-hour period, then the restore operation will produce the same results regardless of which time value was provided. 我们建议你使用 UTC 时间指定还原点,避免出现意外结果。Specifying a UTC time for the restore point is recommended to avoid unexpected results.

执行还原操作Perform a restore operation

你可以还原存储帐户中的所有容器,或者还原一个或多个容器中的一系列 blob。You can restore all containers in the storage account, or you can restore a range of blobs in one or more containers. 许多 blob 是按照字典顺序定义的。A range of blobs is defined lexicographically, meaning in dictionary order. 每个还原操作最多支持 10 个字典范围。Up to ten lexicographical ranges are supported per restore operation. 包括范围的开始值,但不包括范围的结束值。The start of the range is inclusive, and the end of the range is exclusive.

为开始范围和结束范围指定的容器模式必须包含至少三个字符(即最小值为 3)。The container pattern specified for the start range and end range must include a minimum of three characters. 用于分隔容器名称与 blob 名称的正斜杠 (/) 不计入该最小值。The forward slash (/) that is used to separate a container name from a blob name does not count toward this minimum.

在字典范围内不支持通配符。Wildcard characters are not supported in a lexicographical range. 任何通配符字符都被视为标准字符。Any wildcard characters are treated as standard characters.

可以还原 $root$web 容器中的 blob,方法是:在传递给还原操作的范围中显式指定它们。You can restore blobs in the $root and $web containers by explicitly specifying them in a range passed to a restore operation. $root$web 容器只有在显式指定的情况下才会进行还原。The $root and $web containers are restored only if they are explicitly specified. 无法还原其他系统容器。Other system containers cannot restored.

仅还原块 blob。Only block blobs are restored. 还原操作不支持页 blob 和追加 blob。Page blobs and append blobs are not included in a restore operation. 有关追加 blob 的限制的详细信息,请参阅块 blob 的时间点还原For more information about limitations related to append blobs, see Point-in-time restore for block blobs.

重要

执行还原操作时,Azure 存储会阻止对在操作期间还原的范围内的 blob 执行数据操作。When you perform a restore operation, Azure Storage blocks data operations on the blobs in the ranges being restored for the duration of the operation. 读取、写入和删除操作在主位置中被阻止。Read, write, and delete operations are blocked in the primary location. 出于此原因,在执行还原操作时,Azure 门户中的操作(如列出容器)可能不会按预期执行。For this reason, operations such as listing containers in the Azure portal may not perform as expected while the restore operation is underway.

如果存储帐户是异地复制的,则在还原操作期间,从辅助位置读取的操作可以继续。Read operations from the secondary location may proceed during the restore operation if the storage account is geo-replicated.

还原一组数据所用的时间取决于在还原期间执行的写入和删除操作的次数。The time that it takes to restore a set of data is based on the number of write and delete operations made during the restore period. 例如,如果一个帐户有 1 百万个对象,每天增加 3,000 个对象,每天删除 1,000 个对象,将需要大约两个小时才能还原到过去 30 天的点。For example, an account with one million objects with 3,000 objects added per day and 1,000 objects deleted per day will require approximately two hours to restore to a point 30 days in the past. 对于具有此变化率的帐户,不建议在过去保留时间和还原超过90天。A retention period and restoration more than 90 days in the past would not be recommended for an account with this rate of change.

还原帐户中的所有容器Restore all containers in the account

你可以还原存储帐户中的所有容器,使其还原到之前某一给定时间点的状态。You can restore all containers in the storage account to return them to their previous state at a given point in time.

要通过 Azure 门户还原存储帐户中的所有容器,请执行以下步骤:To restore all containers and blobs in the storage account with the Azure portal, follow these steps:

  1. 导航到存储帐户的容器列表。Navigate to the list of containers for your storage account.

  2. 在工具栏中依次选择“还原容器”和“全部还原” 。On the toolbar, choose Restore containers, then Restore all.

  3. 在“还原所有容器”窗格中,通过提供日期和时间指定还原点。In the Restore all containers pane, specify the restore point by providing a date and time.

  4. 勾选复选框,确认继续操作。Confirm that you want to proceed by checking the box.

  5. 选择“还原”,开始还原操作。Select Restore to begin the restore operation.

    显示如何将所有容器还原到指定还原点的屏幕截图

还原多个块 blobRestore ranges of block blobs

你可以在单个或多个容器中还原一个或多个字典范围的 blob,将这些 blob 还原到之前某一给定时间点的状态。You can restore one or more lexicographical ranges of blobs within a single container or across multiple containers to return those blobs to their previous state at a given point in time.

要通过 Azure 门户还原一个或多个容器的一系列 blob,请执行以下步骤:To restore a range of blobs in one or more containers with the Azure portal, follow these steps:

  1. 导航到存储帐户的容器列表。Navigate to the list of containers for your storage account.

  2. 选择要还原的容器。Select the container or containers to restore.

  3. 在工具栏中依次选择“还原容器”和“还原所选容器” 。On the toolbar, choose Restore containers, then Restore selected.

  4. 在“还原所选容器”窗格中,通过提供日期和时间指定还原点。In the Restore selected containers pane, specify the restore point by providing a date and time.

  5. 指定要还原的范围。Specify the ranges to restore. 使用正斜杠 (/) 将容器名与 blob 前缀分隔开。Use a forward slash (/) to delineate the container name from the blob prefix.

  6. 默认情况下,“还原所选容器”窗格会指定一个包含容器中所有 blob 的范围。By default the Restore selected containers pane specifies a range that includes all blobs in the container. 如果不希望还原整个容器,可删除此范围。Delete this range if you do not want to restore the entire container. 下图显示了默认范围。The default range is shown in the following image.

    显示在指定自定义范围之前要删除的默认 blob 范围的屏幕截图

  7. 勾选复选框,确认继续操作。Confirm that you want to proceed by checking the box.

  8. 选择“还原”,开始还原操作。Select Restore to begin the restore operation.

下图显示对一组范围执行的还原操作。The following image shows a restore operation on a set of ranges.

显示如何在一个或多个容器中还原多个范围的 blob 的屏幕截图

图像中显示的还原操作执行以下操作:The restore operation shown in the image performs the following actions:

  • 还原 container1 的全部内容。Restores the complete contents of container1.
  • 在 container2 中还原字典范围 blob1 到 blob5 中的 blob 。Restores blobs in the lexicographical range blob1 through blob5 in container2. 此范围还原名称为 blob1、blob11、blob100 和 blob2 的 Blob 。This range restores blobs with names such as blob1, blob11, blob100, blob2, and so on. 由于不包括范围的结束值,因此它会还原名称以 blob4 开头的 blob,但不会还原名称以 blob5 开头的 blob 。Because the end of the range is exclusive, it restores blobs whose names begin with blob4, but does not restore blobs whose names begin with blob5.
  • 还原 container3 和 container4 中的所有 blob 。Restores all blobs in container3 and container4. 因为不包括范围的结束值,所以此范围不会还原 container5。Because the end of the range is exclusive, this range does not restore container5.

后续步骤Next steps