检查存储帐户的“上次同步时间”属性Check the Last Sync Time property for a storage account

在配置存储帐户时,可以指定将数据复制到距离主要区域数百英里的次要区域。When you configure a storage account, you can specify that your data is copied to a secondary region that is hundreds of miles from the primary region. 异地复制在主要区域发生严重中断(例如自然灾害)时为你的数据提供持续性。Geo-replication offers durability for your data in the event of a significant outage in the primary region, such as a natural disaster. 如果你额外启用对次要区域的读取访问,则当主要区域不可用时,你的数据仍可以用于读取操作。If you additionally enable read access to the secondary region, your data remains available for read operations if the primary region becomes unavailable. 你可以将应用程序设计为当主要区域无响应时无缝切换到从次要区域进行读取。You can design your application to switch seamlessly to reading from the secondary region if the primary region is unresponsive.

异地冗余存储 (GRS) 以异步方式将数据复制到次要区域。Geo-redundant storage (GRS) replicates your data asynchronously to a secondary region. 若要对次要区域进行读取访问,请启用读取访问异地冗余存储 (RA-GRS)。For read access to the secondary region, enable read-access geo-redundant storage (RA-GRS). 若要详细了解 Azure 存储提供的冗余的各种选项,请参阅 Azure 存储冗余For more information about the various options for redundancy offered by Azure Storage, see Azure Storage redundancy.

本文介绍了如何检查存储帐户的“上次同步时间”属性,以便评估主要区域与次要区域之间的任何差异。This article describes how to check the Last Sync Time property for your storage account so that you can evaluate any discrepancy between the primary and secondary regions.

关于“上次同步时间”属性About the Last Sync Time property

因为异地复制是异步的,所以在发生中断时,已写入到主要区域的数据可能尚未写入到次要区域。Because geo-replication is asynchronous, it is possible that data written to the primary region has not yet been written to the secondary region at the time an outage occurs. “上次同步时间”属性表示,最近一次将主要区域中的数据成功写入到次要区域的时间。The Last Sync Time property indicates the last time that data from the primary region was written successfully to the secondary region. 在上次同步时间之前对主要区域所做的所有写入都可以从次要位置读取。All writes made to the primary region before the last sync time are available to be read from the secondary location. 在上次同步时间之后对主要区域所做的写入尚不一定可供读取。Writes made to the primary region after the last sync time property may or may not be available for reads yet.

“上次同步时间”属性是一个 GMT 日期/时间值。The Last Sync Time property is a GMT date/time value.

获取“上次同步时间”属性Get the Last Sync Time property

可以使用 PowerShell 或 Azure CLI 检索“上次同步时间”属性的值。You can use PowerShell or Azure CLI to retrieve the value of the Last Sync Time property.

若要使用 PowerShell 获取存储帐户的上次同步时间,请安装版本 1.11.0 或更高版本的 Az.Storage 模块。To get the last sync time for the storage account with PowerShell, install version 1.11.0 or later of the Az.Storage module. 然后检查存储帐户的 GeoReplicationStats.LastSyncTime 属性。Then check the storage account's GeoReplicationStats.LastSyncTime property. 请务必将占位符值替换为你自己的值:Remember to replace the placeholder values with your own values:

$lastSyncTime = $(Get-AzStorageAccount -ResourceGroupName <resource-group> `
    -Name <storage-account> `
    -IncludeGeoReplicationStats).GeoReplicationStats.LastSyncTime

另请参阅See also