高可用性和 Azure SQL DatabaseHigh-availability and Azure SQL Database

Azure SQL Database 中的高可用性架構的目標是時間的確保您的資料庫已啟動並執行的 99.99%,而不需擔心維護作業和中斷的影響。The goal of the High Availability architecture in Azure SQL Database is to guarantee that your database is up and running 99.99% of time, without worrying about the impact of maintenance operations and outages. Azure 會自動處理重要的維護工作,例如修補、 備份、 Windows 和 SQL 升級,以及非計劃性的事件,例如基礎硬體、 軟體或網路失敗。Azure automatically handles critical servicing tasks, such as patching, backups, Windows and SQL upgrades, as well as unplanned events such as underlying hardware, software or network failures. 當基礎的 SQL 執行個體已修補或容錯移轉時,將停機時間並不值得注意如果您採用重試邏輯應用程式中。When the underlying SQL instance is patched or fails over, the downtime is not noticeable if you employ retry logic in your app. 即使在最關鍵的情況下,Azure SQL Database 也可以快速復原,確保您的資料隨時可用。Azure SQL Database can quickly recover even in the most critical circumstances ensuring that your data is always available.

高可用性解決方案的設計可確保永遠不會因為失敗的維護作業不會影響您的工作負載,而遺失已認可的資料時,資料庫不會失敗,軟體架構中的單一點。The high availability solution is designed to ensure that committed data is never lost due to failures, that maintenance operations do not affect your workload, and that the database will not be a single point of failure in your software architecture. 在升級或維護資料庫時,不會有維護視窗或停機時間要求您停止工作負載。There are no maintenance windows or downtimes that should require you to stop the workload while the database is upgraded or maintained.

有兩個 Azure SQL Database 中使用高可用性架構模型:There are two high-availability architectural models that are used in Azure SQL Database:

  • 隔離的計算和儲存體為基礎的標準可用性模型。Standard availability model that is based on a separation of compute and storage. 它需倚賴的遠端儲存層的高可用性和可靠性。It relies on high availability and reliability of the remote storage tier. 此架構的目標預算為導向的商務應用程式可以容忍某些維護活動期間的效能降低。This architecture targets budget-oriented business applications that can tolerate some performance degradation during maintenance activities.
  • 進階可用性叢集的資料庫引擎處理序為基礎的模型。Premium availability model that is based on a cluster of database engine processes. 它需倚賴,總是有可用的資料庫引擎節點的仲裁的事實。It relies on the fact that there is always a quorum of available database engine nodes. 此架構為目標的任務關鍵性應用程式高 IO 效能、 高交易速率和保證您的工作負載,在維護活動期間的最小效能影響。This architecture targets mission critical applications with high IO performance, high transaction rate and guarantees minimal performance impact to your workload during maintenance activities.

Azure SQL Database 上執行最新的穩定版本的 SQL Server Database Engine 和 Windows OS,而大部分的使用者就不會注意到,持續執行升級。Azure SQL Database runs on the latest stable version of SQL Server Database Engine and Windows OS, and most users would not notice that upgrades are performed continuously.

基本、標準和一般目的服務層級可用性Basic, Standard, and General Purpose service tier availability

這些服務層會運用標準可用性架構。These service tiers leverage the standard availability architecture. 下圖顯示四個不同的節點,以分隔的計算和儲存層。The following figure shows four different nodes with the separated compute and storage layers.

分隔計算與儲存體

標準可用性模型會包含兩個層級:The standard availability model includes two layers:

  • 執行無狀態的計算層sqlserver.exe處理,並包含在連結的 SSD 上只有暫時性和快取資料,例如 TempDB、 model 資料庫,計畫快取、 緩衝集區和資料行存放區集區。A stateless compute layer that runs the sqlserver.exe process and contains only transient and cached data on the attached SSD, such as TempDB, model database, plan cache, buffer pool and column store pool. 這個無狀態的節點由初始化的 Azure Service Fabric sqlserver.exe、 控制節點的健全狀況,並執行容錯移轉至另一個節點,如有必要。This stateless node is operated by Azure Service Fabric that initializes sqlserver.exe, controls health of the node, and performs failover to another node if necessary.
  • 使用 Azure Blob 儲存體中的資料庫檔案 (.mdf/.ldf) 可設定狀態的資料層。A stateful data layer with the database files (.mdf/.ldf) that are stored in Azure Blob storage. Azure blob 儲存體有內建的資料可用性和備援功能。Azure blob storage has built-in data availability and redundancy feature. 它可確保即使 SQL Server 處理序損毀,將會保留在記錄檔或資料檔案中的頁面中的每一筆記錄。It guarantees that every record in the log file or page in the data file will be preserved even if SQL Server process crashes.

每當資料庫引擎或作業系統升級,或在偵測到失敗時,Azure Service Fabric 會移動無狀態的 SQL Server 處理序到另一個無狀態的計算節點具有足夠的可用容量。Whenever the database engine or the operating system is upgraded, or a failure is detected, Azure Service Fabric will move the stateless SQL Server process to another stateless compute node with sufficient free capacity. Azure Blob 儲存體中的資料不會受到移動,而且資料/記錄檔會附加到新初始化的 SQL Server 處理序。Data in Azure Blob storage is not affected by the move, and the data/log files are attached to the newly initialized SQL Server process. 此程序可保證 99.99%可用性,但繁重的工作負載可能會遇到效能降低情況在轉換期間,因為新的 SQL Server 執行個體開頭冷快取。This process guarantees 99.99% availability, but a heavy workload may experience some performance degradation during the transition since the new SQL Server instance starts with cold cache.

進階與商務關鍵性服務層級可用性Premium and Business Critical service tier availability

進階和業務關鍵服務層運用進階可用性模型,整合了計算資源 (SQL Server 資料庫引擎處理序) 和單一節點上的儲存體 (本機連接的 SSD)。Premium and Business Critical service tiers leverage the Premium availability model, which integrates compute resources (SQL Server Database Engine process) and storage (locally attached SSD) on a single node. 將計算和儲存體複寫至其他節點,建立三到四個-節點叢集來達成高可用性。High availability is achieved by replicating both compute and storage to additional nodes creating a three to four-node cluster.

資料庫引擎節點的叢集

基礎資料庫檔案 (.mdf/.ldf) 放在連結的 SSD 儲存體,以提供您的工作負載非常低的延遲 IO。The underlying database files (.mdf/.ldf) are placed on the attached SSD storage to provide very low latency IO to your workload. 使用類似於 SQL Server 的技術來實作高可用性Always On 可用性群組High availability is implemented using a technology similar to SQL Server Always On Availability Groups. 叢集包含單一主要複本 (SQL Server 處理序) 存取讀寫客戶工作負載,以及最多三個的次要複本 (計算和儲存體),其中包含資料的複本。The cluster includes a single primary replica (SQL Server process) that is accessible for read-write customer workloads, and up to three secondary replicas (compute and storage) containing copies of data. 主要節點經常將變更推送至順序中的次要節點,並確保資料同步到至少一個次要複本,再認可每一筆交易。The primary node constantly pushes changes to the secondary nodes in order and ensures that the data is synchronized to at least one secondary replica before committing each transaction. 此程序可保證,如果主要節點損毀,因為任何原因,總是有容錯移轉至完整同步的節點。This process guarantees that if the primary node crashes for any reason, there is always a fully synchronized node to fail over to. Azure Service Fabric 所起始的容錯移轉。The failover is initiated by the Azure Service Fabric. 一旦次要複本會變成新的主要節點,以確保叢集具有足夠的節點 (仲裁集) 建立另一個次要複本。Once the secondary replica becomes the new primary node, another secondary replica is created to ensure the cluster has enough nodes (quorum set). 容錯移轉完成之後,SQL 連線會自動重新導向至新的主要節點。Once failover is complete, SQL connections are automatically redirected to the new primary node.

作為額外的權益,premium 可用性模型會包含唯讀的 SQL 連線重新導向到其中一個次要複本的能力。As an extra benefit, the premium availability model includes the ability to redirect read-only SQL connections to one of the secondary replicas. 這項功能稱為讀取相應放大。它提供 100%額外計算容量,而且無須額外付費以 off-load 唯讀作業,例如從主要複本的分析工作負載。This feature is called Read Scale-Out. It provides 100% additional compute capacity at no extra charge to off-load read-only operations, such as analytical workloads, from the primary replica.

區域備援設定Zone redundant configuration

根據預設,在相同資料中心建立進階可用性模型節點的叢集。By default, the cluster of nodes for the premium availability model is created in the same datacenter. 引進Azure 可用性區域,SQL Database 可以將不同的複本放在叢集中相同的區域中的不同可用性區域。With the introduction of Azure Availability Zones, SQL Database can place different replicas in the cluster to different availability zones in the same region. 為了避免發生單點失敗,系統也會跨多個區域將控制環複寫成三個閘道環 (GW)。To eliminate a single point of failure, the control ring is also duplicated across multiple zones as three gateway rings (GW). Azure 流量管理員 (ATM) 會控制特定閘道的路由。The routing to a specific gateway ring is controlled by Azure Traffic Manager (ATM). 由於區域備援設定進階或業務關鍵服務層中的不會建立額外的資料庫備援,您可以啟用它無需額外費用。Because the zone redundant configuration in the Premium or Business Critical service tiers does not create additional database redundancy, you can enable it at no extra cost. 藉由選取區域備援設定,您可以對您的進階或業務關鍵資料庫復原一組更大規模的失敗情況,包括災難性的資料中心中斷,而不需要任何變更,應用程式邏輯。By selecting a zone redundant configuration, you can make your Premium or Business Critical databases resilient to a much larger set of failures, including catastrophic datacenter outages, without any changes to the application logic. 您也可以將任何現有的進階或業務關鍵資料庫或彈性集區轉換成區域備援組態。You can also convert any existing Premium or Business Critical databases or pools to the zone redundant configuration.

由於區域備援資料庫與彼此之間有些距離的不同資料中心內有複本,增加的網路延遲可能會增加的認可時間,並因此會影響某些 OLTP 工作負載的效能。Because the zone redundant databases have replicas in different datacenters with some distance between them, the increased network latency may increase the commit time and thus impact the performance of some OLTP workloads. 您一律可以停用區域備援設定來回到單一區域設定。You can always return to the single-zone configuration by disabling the zone redundancy setting. 此程序是一項線上作業類似於一般的服務層升級。This process is an online operation similar to the regular service tier upgrade. 在此程序結束時,資料庫或集區會從區域備援環移轉成單一區域環,或反之亦然。At the end of the process, the database or pool is migrated from a zone redundant ring to a single zone ring or vice versa.

重要

區域備援資料庫和彈性集區目前都在精選區域中的進階和業務關鍵服務層中才支援。Zone redundant databases and elastic pools are currently only supported in the Premium and Business Critical service tiers in select regions. 當使用業務關鍵層中,區域備援設定時才可用在選取的第 5 代計算硬體。When using the Business Critical tier, zone redundant configuration is only available when the Gen5 compute hardware is selected. 最新狀態的支援區域備援資料庫的區域的詳細資訊,請參閱依區域的服務支援For up to date information about the regions that support zone redundant databases, see Services support by region.

下圖說明區域備援版的高可用性架構:The zone redundant version of the high availability architecture is illustrated by the following diagram:

高可用性架構區域備援

加速資料庫復原 (ADR)Accelerated Database Recovery (ADR)

加速資料庫復原 (ADR)新 SQL 資料庫引擎的功能,可大幅提升資料庫的可用性,尤其是有長時間執行交易。Accelerated Database Recovery (ADR) is a new SQL database engine feature that greatly improves database availability, especially in the presence of long running transactions. ADR 目前適用於單一資料庫、彈性集區和 Azure SQL 資料倉儲。ADR is currently available for single databases, elastic pools, and Azure SQL Data Warehouse.

結論Conclusion

Azure SQL Database 功能的內建高可用性解決方案,與 Azure 平台密切整合。Azure SQL Database features a built-in high availability solution, that is deeply integrated with the Azure platform. 它是相依進行失敗偵測和復原的 Service Fabric、 Azure Blob 儲存體的資料保護和更高的容錯移轉的可用性區域。It is dependent on Service Fabric for failure detection and recovery, on Azure Blob storage for data protection, and on Availability Zones for higher fault tolerance. 此外,Azure SQL database 會運用複寫和容錯移轉 SQL Server 的 Always On 可用性群組技術。In addition, Azure SQL database leverages the Always On Availability Group technology from SQL Server for replication and failover. 這些技術的組合可讓應用程式完全了解混合式儲存體的優點模型,並支援最嚴苛的 Sla。The combination of these technologies enables applications to fully realize the benefits of a mixed storage model and support the most demanding SLAs.

後續步驟Next steps