Azure 存储冗余Azure Storage redundancy

Azure 存储始终会存储数据的多个副本,以防范各种计划内和计划外的事件,包括暂时性的硬件故障、网络中断或断电、大范围自然灾害等。Azure Storage always stores multiple copies of your data so that it is protected from planned and unplanned events, including transient hardware failures, network or power outages, and massive natural disasters. 即使面临故障时,冗余也可确保存储帐户满足 Azure 存储的服务级别协议 (SLA) 的要求。Redundancy ensures that your storage account meets the Service-Level Agreement (SLA) for Azure Storage even in the face of failures.

在确定最适合自己方案的冗余选项时,请考虑如何在较低成本与较高可用性和持久性之间做出取舍。When deciding which redundancy option is best for your scenario, consider the tradeoffs between lower costs and higher availability and durability. 可帮助你确定应选择哪种冗余选项的因素包括:The factors that help determine which redundancy option you should choose include:

  • 如何在主要区域中复制数据How your data is replicated in the primary region
  • 是否要将你的数据复制到地理上距主要区域较远的另一个区域,以防范区域性灾难Whether your data is replicated to a second region that is geographically distant to the primary region, to protect against regional disasters
  • 应用程序是否要求在主要区域出于任何原因而不可用时,能够对次要区域中复制的数据进行读取访问Whether your application requires read access to the replicated data in the secondary region if the primary region becomes unavailable for any reason

主要区域中的冗余Redundancy in the primary region

Azure 存储帐户中的数据始终在主要区域中复制三次:Data in an Azure Storage account is always replicated three times in the primary region:

本地冗余存储 (LRS) 在主要区域中的单个物理位置内同步复制数据三次。Locally redundant storage (LRS) copies your data synchronously three times within a single physical location in the primary region. LRS 是成本最低的复制选项,但对于需要高可用性的应用程序,不建议使用此选项。LRS is the least expensive replication option, but is not recommended for applications requiring high availability.

本地冗余存储Locally-redundant storage

本地冗余存储 (LRS) 在主要区域中的单个物理位置内复制数据三次。Locally redundant storage (LRS) replicates your data three times within a single physical location in the primary region. LRS 可在一年中提供至少 99.999999999%(11 个 9)的对象持久性。LRS provides at least 99.999999999% (11 nines) durability of objects over a given year.

与其他选项相比,LRS 是成本最低的冗余选项,但提供的持久性也最低。LRS is the lowest-cost redundancy option and offers the least durability compared to other options. LRS 可以保护数据,使其不受服务器机架和驱动器故障影响。LRS protects your data against server rack and drive failures. 但是,如果数据中心发生火灾或洪灾等灾难,使用 LRS 的存储帐户的所有副本可能会丢失或不可恢复。However, if a disaster such as fire or flooding occurs within the data center, all replicas of a storage account using LRS may be lost or unrecoverable. 为了减轻此风险,Azure 建议使用异地冗余存储 (GRS)。To mitigate this risk, Azure recommends using geo-redundant storage (GRS).

对使用 LRS 的存储帐户的写入请求将以同步方式发生。A write request to a storage account that is using LRS happens synchronously. 只有将数据写入到所有三个副本后,写入操作才会成功返回。The write operation returns successfully only after the data is written to all three replicas.

对于以下场景,LRS 是不错的选项:LRS is a good choice for the following scenarios:

  • 如果应用程序存储着在发生数据丢失时可轻松重构的数据,则可以选择 LRS。If your application stores data that can be easily reconstructed if data loss occurs, you may opt for LRS.
  • 如果出于数据监管要求,应用程序限制为只能在一个区域中复制数据,则可以选择 LRS。If your application is restricted to replicating data only within a region due to data governance requirements, you may opt for LRS. 在某些情况下,要在其中异地复制数据的配对区域可位于另一个国家/地区。In some cases, the paired regions across which the data is geo-replicated may be in another region.

次要区域中的冗余Redundancy in a secondary region

对于需要高可用性的应用程序,可以选择将存储帐户中的数据另外复制到距离主要区域数百英里以外的次要区域。For applications requiring high availability, you can choose to additionally copy the data in your storage account to a secondary region that is hundreds of miles away from the primary region. 如果存储帐户已复制到次要区域,则即使遇到区域性服务完全中断或导致主要区域不可恢复的灾难,数据也能持久保存。If your storage account is copied to a secondary region, then your data is durable even in the case of a complete regional outage or a disaster in which the primary region isn't recoverable.

创建存储帐户时,可以为帐户选择主要区域。When you create a storage account, you select the primary region for the account. 配对的次要区域是根据主要区域确定的且无法更改。The paired secondary region is determined based on the primary region, and can't be changed.

Azure 存储提供一个将数据复制到次要区域的选项:Azure Storage offers one option for copying your data to a secondary region:

异地冗余存储 (GRS) 使用 LRS 在主要区域中的单个物理位置内同步复制数据三次。Geo-redundant storage (GRS) copies your data synchronously three times within a single physical location in the primary region using LRS. 然后,它将数据异步复制到次要区域中的单个物理位置。It then copies your data asynchronously to a single physical location in the secondary region.

如果主要区域不可用,可以选择故障转移到次要区域。If the primary region becomes unavailable, you can choose to fail over to the secondary region. 故障转移完成后,次要区域将成为主要区域,你便可以再次读取和写入数据。After the failover has completed, the secondary region becomes the primary region, and you can again read and write data. 有关灾难恢复以及如何故障转移到次要区域的详细信息,请参阅灾难恢复和存储帐户故障转移For more information on disaster recovery and to learn how to fail over to the secondary region, see Disaster recovery and storage account failover.

重要

由于数据以异步方式复制到次要区域,因此如果无法恢复主要区域,则影响主要区域的故障可能会导致数据丢失。Because data is replicated to the secondary region asynchronously, a failure that affects the primary region may result in data loss if the primary region cannot be recovered. 最近对主要区域的写入与最近对次要区域的写入之间的时间间隔称为恢复点目标 (RPO)。The interval between the most recent writes to the primary region and the last write to the secondary region is known as the recovery point objective (RPO). RPO 指示可以将数据恢复到的时间点。The RPO indicates the point in time to which data can be recovered. Azure 存储的 RPO 通常小于 15 分钟,但目前没有有关将数据复制到次要区域所用的时长的 SLA。Azure Storage typically has an RPO of less than 15 minutes, although there's currently no SLA on how long it takes to replicate data to the secondary region.

异地冗余存储Geo-redundant storage

异地冗余存储 (GRS) 使用 LRS 在主要区域中的单个物理位置内同步复制数据三次。Geo-redundant storage (GRS) copies your data synchronously three times within a single physical location in the primary region using LRS. 然后,它将数据异步复制到距离主要区域数百英里以外的次要区域中的单个物理位置。It then copies your data asynchronously to a single physical location in a secondary region that is hundreds of miles away from the primary region. GRS 在给定一年中提供至少 99.99999999999999%(16 个 9)的 Azure 存储数据对象持久性。GRS offers durability for Azure Storage data objects of at least 99.99999999999999% (16 9's) over a given year.

首先会将写入操作提交到主要位置,并使用 LRS 复制该操作。A write operation is first committed to the primary location and replicated using LRS. 然后会以异步方式将更新复制到次要区域。The update is then replicated asynchronously to the secondary region. 将数据写入次要位置后,还会使用 LRS 在该位置复制数据。When data is written to the secondary location, it's also replicated within that location using LRS.

对次要区域中数据的读取访问Read access to data in the secondary region

异地冗余存储将数据复制到次要区域中的另一个物理位置,以防范区域性服务中断。Geo-redundant storage replicates your data to another physical location in the secondary region to protect against regional outages. 但是,仅当客户或 Azure 发起了从主要区域到次要区域的故障转移时,数据才可供读取。However, that data is available to be read only if the customer or Azure initiates a failover from the primary to secondary region. 启用对次要区域的读取访问时,如果主要区域不可用,则数据可供读取。When you enable read access to the secondary region, your data is available to be read if the primary region becomes unavailable. 若要对次要区域进行读取访问,请启用读取访问异地冗余存储 (RA-GRS)。For read access to the secondary region, enable read-access geo-redundant storage (RA-GRS).

设计应用程序以便能够对次要区域进行读取访问Design your applications for read access to the secondary

如果存储帐户已配置为对次要区域进行读取访问,则你可以设计自己的应用程序,以便在主要区域出于任何原因而不可用时,能够无缝转换为从次要区域读取数据。If your storage account is configured for read access to the secondary region, then you can design your applications to seamlessly shift to reading data from the secondary region if the primary region becomes unavailable for any reason.

启用 RA-GRS 后,次要区域可用于读取访问,因此你可以预先测试应用程序,以确保在发生服务中断时可以从次要区域正确读取数据。The secondary region is available for read access after you enable RA-GRS, so that you can test your application in advance to make sure that it will properly read from the secondary in the event of an outage. 有关如何设计应用程序以实现高可用性的详细信息,请参阅使用异地冗余设计高度可用的应用程序For more information about how to design your applications for high availability, see Use geo-redundancy to design highly available applications.

启用对次要区域的读取访问后,应用程序可以从次要终结点以及主要终结点读取数据。When read access to the secondary is enabled, your application can be read from the secondary endpoint as well as from the primary endpoint. 次要终结点在帐户名的后面追加了后缀 -secondaryThe secondary endpoint appends the suffix -secondary to the account name. 例如,如果 Blob 存储的主要终结点是 myaccount.blob.core.chinacloudapi.cn,则次要终结点是 myaccount-secondary.blob.core.chinacloudapi.cnFor example, if your primary endpoint for Blob storage is myaccount.blob.core.chinacloudapi.cn, then the secondary endpoint is myaccount-secondary.blob.core.chinacloudapi.cn. 存储帐户的帐户访问密钥对于主要终结点和次要终结点是相同的。The account access keys for your storage account are the same for both the primary and secondary endpoints.

检查“上次同步时间”属性Check the Last Sync Time property

由于数据以异步方式复制到次要区域,因此次要区域通常位于主要区域的后面。Because data is replicated to the secondary region asynchronously, the secondary region is often behind the primary region. 如果主要区域发生故障,对主要区域的所有写入有可能尚未复制到次要区域。If a failure happens in the primary region, it's likely that all writes to the primary will not yet have been replicated to the secondary.

若要确定哪些写入操作已复制到次要区域,应用程序可以检查存储帐户的“上次同步时间”属性。To determine which write operations have been replicated to the secondary region, your application can check the Last Sync Time property for your storage account. 在上次同步时间之前写入到主要区域的所有写入操作已成功复制到次要区域,这意味着,可以从次要区域读取这些操作。All write operations written to the primary region prior to the last sync time have been successfully replicated to the secondary region, meaning that they are available to be read from the secondary. 在上次同步时间之后写入到主要区域的任何写入操作不一定已复制到次要区域,这意味着,它们不一定可供读取操作使用。Any write operations written to the primary region after the last sync time may or may not have been replicated to the secondary region, meaning that they may not be available for read operations.

可以使用 Azure PowerShell、Azure CLI 或某个 Azure 存储客户端库查询“上次同步时间”属性的值。You can query the value of the Last Sync Time property using Azure PowerShell, Azure CLI, or one of the Azure Storage client libraries. “上次同步时间”属性是一个 GMT 日期/时间值。The Last Sync Time property is a GMT date/time value. 有关详细信息,请参阅检查存储帐户的“上次同步时间”属性For more information, see Check the Last Sync Time property for a storage account.

冗余选项摘要Summary of redundancy options

以下各部分中的表总结了可用于 Azure 存储的冗余选项The tables in the following sections summarize the redundancy options available for Azure Storage

持久性和可用性参数Durability and availability parameters

下表描述了每个冗余选项的关键参数:The following table describes key parameters for each redundancy option:

参数Parameter LRSLRS GRS/RA-GRSGRS/RA-GRS
给定一年内的对象持久性百分比1Percent durability of objects over a given year1 至少 99.999999999%(11 个 9)at least 99.999999999% (11 9's) 至少 99.99999999999999%(16 个 9)at least 99.99999999999999% (16 9's)
读取请求的可用性 SLA1Availability SLA for read requests1 至少为 99.9%(冷访问层为 99%)At least 99.9% (99% for cool access tier) GRS 至少为 99.9%(冷访问层为 99%)At least 99.9% (99% for cool access tier) for GRS

RA-GRS 至少为 99.99%(冷访问层为 99.9%)At least 99.99% (99.9% for cool access tier) for RA-GRS
写入请求的可用性 SLA1Availability SLA for write requests1 至少为 99.9%(冷访问层为 99%)At least 99.9% (99% for cool access tier) 至少为 99.9%(冷访问层为 99%)At least 99.9% (99% for cool access tier)

1 有关 Azure 存储确保持续性和可用性的信息,请参阅 Azure 存储 SLA1 For information about Azure Storage guarantees for durability and availability, see the Azure Storage SLA.

持久性和可用性(按中断方案)Durability and availability by outage scenario

下表指示数据是否持久且在给定方案中可用,具体取决于对存储帐户启用的冗余类型:The following table indicates whether your data is durable and available in a given scenario, depending on which type of redundancy is in effect for your storage account:

中断方案Outage scenario LRSLRS GRS/RA-GRSGRS/RA-GRS
数据中心内的某个节点不可用A node within a data center becomes unavailable Yes Yes
整个数据中心(区域性或非区域性)不可用An entire data center (zonal or non-zonal) becomes unavailable No Yes
主要区域发生区域范围的服务中断A region-wide outage occurs in the primary region No Yes
如果主区域变得不可用,可对次要区域进行读取访问Read access to the secondary region is available if the primary region becomes unavailable No 是(通过 RA-GRS)Yes (with RA-GRS)

支持的存储帐户类型Supported storage account types

下表显示了每种存储帐户类型都支持哪些冗余选项。The following table shows which redundancy options are supported by each type of storage account. 有关存储帐户类型,请参阅存储帐户概述For information for storage account types, see Storage account overview.

LRSLRS GRS/RA-GRSGRS/RA-GRS
常规用途 v2General-purpose v2
常规用途 v1General-purpose v1
块 Blob 存储Block blob storage
Blob 存储Blob storage
文件存储File storage
常规用途 v2General-purpose v2
常规用途 v1General-purpose v1
Blob 存储Blob storage

所有存储帐户的所有数据的复制均基于存储帐户的冗余选项。All data for all storage accounts is copied according to the redundancy option for the storage account. 复制的对象包括块 Blob、追加 Blob、页 Blob、队列、表和文件。Objects including block blobs, append blobs, page blobs, queues, tables, and files are copied. 将复制所有层(包括存档层)中的数据。Data in all tiers, including the archive tier, is copied. 有关 blob 层的详细信息,请参阅 Azure Blob 存储:热、冷和存档访问层For more information about blob tiers, see Azure Blob storage: hot, cool, and archive access tiers.

有关每个冗余选项的定价信息,请参阅 Azure 存储定价For pricing information for each redundancy option, see Azure Storage pricing.

备注

Azure 高级磁盘存储目前仅支持本地冗余存储 (LRS)。Azure Premium Disk Storage currently supports only locally redundant storage (LRS). 块 Blob 存储帐户在特定区域支持本地冗余存储 (LRS)。Block blob storage accounts support locally redundant storage (LRS) in certain regions.

数据完整性Data integrity

Azure 存储使用循环冗余检查 (CRC) 定期验证存储的数据的完整性。Azure Storage regularly verifies the integrity of data stored using cyclic redundancy checks (CRCs). 如果检测到数据损坏,则使用冗余数据进行修复。If data corruption is detected, it is repaired using redundant data. Azure 存储还对所有网络流量计算校验和,以检测存储或检索数据时数据包损坏的情况。Azure Storage also calculates checksums on all network traffic to detect corruption of data packets when storing or retrieving data.

另请参阅See also