Always On 可用性群組:高可用性和災害復原解決方案Always On availability groups: a high-availability and disaster-recovery solution

適用範圍:Applies to: 是SQL ServerSQL Server (所有支援的版本) yesSQL ServerSQL Server (all supported versions) 適用範圍:Applies to: 是SQL ServerSQL Server (所有支援的版本) yesSQL ServerSQL Server (all supported versions)

Always On 可用性群組Always On availability groups 功能是提供資料庫鏡像之企業級替代方案的高可用性與災害復原解決方案。The Always On 可用性群組Always On availability groups feature is a high-availability and disaster-recovery solution that provides an enterprise-level alternative to database mirroring. SQL Server 2012 (11.x)SQL Server 2012 (11.x)中導入的 Always On 可用性群組Always On availability groups 可讓企業將一組使用者資料庫的可用性提高到最大程度。Introduced in SQL Server 2012 (11.x)SQL Server 2012 (11.x), Always On 可用性群組Always On availability groups maximizes the availability of a set of user databases for an enterprise. 「可用性群組」 (Availability Group) 支援一組可一起容錯移轉之離散化使用者資料庫的容錯移轉環境,也就是所謂的 「可用性資料庫」 (Availability Database)。An availability group supports a failover environment for a discrete set of user databases, known as availability databases, that fail over together. 可用性群組支援一組讀寫的主要資料庫,以及一到八組對應的次要資料庫。An availability group supports a set of read-write primary databases and one to eight sets of corresponding secondary databases. 此外,您可以將次要資料庫用於唯讀存取及/或某些備份作業。Optionally, secondary databases can be made available for read-only access and/or some backup operations.

可用性群組會在可用性複本層級容錯移轉。An availability group fails over at the level of an availability replica. 容錯移轉不是因資料庫問題 (例如資料庫因為資料檔案遺失而變得可疑、資料庫刪除或交易記錄損毀) 而造成的。Failovers are not caused by database issues such as a database becoming suspect due to a loss of a data file, deletion of a database, or corruption of a transaction log.

注意

AlwaysOn 可用性群組是這個可用性功能的完整正式名稱。Always On availability groups is the full, formal name for this availability feature. 縮寫是 AG,而不是 AOAG 或 AAG。The abbreviation is AG, not AOAG or AAG.

優點Benefits

Always On 可用性群組Always On availability groups 提供了一組豐富的選項,可改善資料庫可用性並實現改善的資源使用方式。provides a rich set of options that improve database availability and that enable improved resource use. 關鍵元件如下:The key components are as follows:

  • 最多支援九個可用性複本。Supports up to nine availability replicas. 「可用性複本」 (Availability Replica) 是特定 SQL Server 執行個體所裝載之可用性群組的具現化,其中維護屬於可用性群組之每個可用性資料庫的本機複本。An availability replica is an instantiation of an availability group that is hosted by a specific instance of SQL Server and maintains a local copy of each availability database that belongs to the availability group. 每個可用性群組都支援一個主要複本和最多八個次要複本。Each availability group supports one primary replica and up to eight secondary replicas. 如需詳細資訊,請參閱 AlwaysOn 可用性群組概觀 (SQL Server)For more information, see Overview of Always On Availability Groups (SQL Server).

    重要

    每個可用性複本都必須位在單一 Windows Server 容錯移轉叢集 (WSFC) 叢集的不同節點。Each availability replica must reside on a different node of a single Windows Server Failover Clustering (WSFC) cluster. 如需可用性群組之必要條件、限制和建議的詳細資訊,請參閱 AlwaysOn 可用性群組的必要條件、限制和建議 (SQL Server)For more information about prerequisites, restrictions, and recommendations for availability groups, see Prerequisites, Restrictions, and Recommendations for Always On Availability Groups (SQL Server).

  • 支援替代可用性模式,如下所示:Supports alternative availability modes, as follows:

    • 非同步認可模式 。Asynchronous-commit mode. 這種可用性模式是一種當可用性複本分散距離相當遠時仍可正常運作的災害復原方案。This availability mode is a disaster-recovery solution that works well when the availability replicas are distributed over considerable distances.

    • 同步認可模式 。Synchronous-commit mode. 這種可用性模式強調的是高可用性和資料保護而非效能,但是相對地增加了交易延遲。This availability mode emphasizes high availability and data protection over performance, at the cost of increased transaction latency. 給定的可用性群組最多可支援五個同步認可哥用性複本,包括目前的主要複本。A given availability group can support up to five synchronous-commit availability replicas, including the current primary replica.

    如需詳細資訊,請參閱 可用性模式 (AlwaysOn 可用性群組)或 PowerShell,針對 AlwaysOn 可用性群組執行規劃的手動容錯移轉或強制手動容錯移轉 (強制容錯移轉)。For more information, see Availability Modes (Always On Availability Groups).

    SQL Server 2019 (15.x)SQL Server 2019 (15.x) 會將同步複本的數目上限,從 SQL Server 2017 (14.x)SQL Server 2017 (14.x) 中最多為 3 的狀態增加至 5。increases the maximum number of synchronous replicas to 5, up from 3 in SQL Server 2017 (14.x)SQL Server 2017 (14.x). 您可以設定這五個複本的群組,使其在群組內具備自動容錯移轉。You can configure this group of five replicas to have automatic failover within the group. 有一個主要複本,再加上四個同步次要複本。There is one primary replica, plus four synchronous secondary replicas.

  • 支援許多可用性群組容錯移轉形式:自動容錯移轉、規劃的手動容錯移轉 (通常只稱為「手動容錯移轉」),以及強制手動容錯移轉 (通常只稱為「強制容錯移轉」)。Supports several forms of availability-group failover: automatic failover, planned manual failover (generally referred as simply "manual failover"), and forced manual failover (generally referred as simply "forced failover"). 如需詳細資訊,請參閱本主題稍後的 容錯移轉及容錯移轉模式 (AlwaysOn 可用性群組)For more information, see Failover and Failover Modes (Always On Availability Groups).

  • 可讓您將給定的可用性複本設定為支援下列其中一種或兩種使用中次要功能:Enables you to configure a given availability replica to support either or both of the following active-secondary capabilities:

    利用使用中次要功能可透過更善用次要硬體資源,改善 IT 效率並降低成本。Using active secondary capabilities improves your IT efficiency and reduce cost through better resource utilization of secondary hardware. 此外,透過將讀取意圖應用程式和備份作業卸載至次要複本,有助於提高主要複本的效能。In addition, offloading read-intent applications and backup jobs to secondary replicas helps to improve performance on the primary replica.

  • 支援每個可用性群組的可用性群組接聽程式。Supports an availability group listener for each availability group. 「可用性群組接聽程式」 是用戶端可連接的伺服器名稱,以便存取 AlwaysOn 可用性群組之主要或次要複本中的資料庫。An availability group listener is a server name to which clients can connect in order to access a database in a primary or secondary replica of an Always On availability group. 可用性群組接聽程式會將內送連接導向至主要複本或唯讀次要複本。Availability group listeners direct incoming connections to the primary replica or to a read-only secondary replica. 接聽程式會在可用性群組容錯移轉之後提供快速應用程式容錯移轉。The listener provides fast application failover after an availability group fails over. 如需詳細資訊,請參閱可用性群組接聽程式、用戶端連接性及應用程式容錯移轉 (SQL Server)For more information, see Availability Group Listeners, Client Connectivity, and Application Failover (SQL Server).

  • 支援彈性容錯移轉原則,以便有效控制可用性群組容錯移轉。Supports a flexible failover policy for greater control over availability-group failover. 如需詳細資訊,請參閱本主題稍後的 容錯移轉及容錯移轉模式 (AlwaysOn 可用性群組)For more information, see Failover and Failover Modes (Always On Availability Groups).

  • 支援防止頁面損毀的自動頁面修復。Supports automatic page repair for protection against page corruption. 如需詳細資訊,請參閱本主題稍後的 自動修復頁面 (可用性群組:資料庫鏡像)For more information, see Automatic Page Repair (Availability Groups: Database Mirroring).

  • 支援加密和壓縮,可提供安全且高效能的傳輸方式。Supports encryption and compression, which provide a secure, high performing transport.

  • 提供一組整合式工具,可簡化可用性群組的部署和管理作業,包括:Provides an integrated set of tools to simplify deployment and management of availability groups, including:

詞彙和定義Terms and Definitions

可用性群組availability group
一組一起容錯移轉之資料庫 (「可用性資料庫」 ) 的容器。A container for a set of databases, availability databases, that fail over together.

可用性資料庫availability database
屬於可用性群組的資料庫。A database that belongs to an availability group. 對於每個可用性資料庫而言,可用性群組會維護單一讀寫複本 (「主要資料庫」 ) 以及一到八個唯讀複本 (「次要資料庫」 )。For each availability database, the availability group maintains a single read-write copy (the primary database) and one to eight read-only copies (secondary databases).

主要資料庫primary database
可用性資料庫的讀寫複本。The read-write copy of an availability database.

次要資料庫secondary database
可用性資料庫的唯讀複本。A read-only copy of an availability database.

可用性複本availability replica
特定 SQL ServerSQL Server 執行個體所裝載之可用性群組的具現化,它會維護屬於可用性群組之每個可用性資料庫的本機副本。An instantiation of an availability group that is hosted by a specific instance of SQL ServerSQL Server and maintains a local copy of each availability database that belongs to the availability group. 有兩種類型的可用性複本存在:單一 「主要複本」 以及一到八個 「次要複本」Two types of availability replicas exist: a single primary replica and one to eight secondary replicas.

主要複本primary replica
可用性複本,該複本可讓主要資料庫用於用戶端的讀寫連接,同時也將每個主要資料庫的交易記錄檔記錄傳送到每個次要複本。The availability replica that makes the primary databases available for read-write connections from clients and, also, sends transaction log records for each primary database to every secondary replica.

次要複本secondary replica
可用性複本,該複本會維護每個可用性資料庫的次要副本,並且當做可用性群組的潛在容錯移轉目標。An availability replica that maintains a secondary copy of each availability database, and serves as a potential failover targets for the availability group. (選擇性) 可支援以唯讀方式存取次要資料庫的次要複本,可以支援在次要資料庫上建立備份。Optionally, a secondary replica can support read-only access to secondary databases can support creating backups on secondary databases.

可用性群組接聽程式availability group listener
用戶端可連接的伺服器名稱,以便存取 AlwaysOn 可用性群組之主要或次要複本中的資料庫。A server name to which clients can connect in order to access a database in a primary or secondary replica of an Always On availability group. 可用性群組接聽程式會將內送連接導向至主要複本或唯讀次要複本。Availability group listeners direct incoming connections to the primary replica or to a read-only secondary replica.

注意

如需詳細資訊,請參閱 AlwaysOn 可用性群組概觀 (SQL Server)For more information, see Overview of Always On Availability Groups (SQL Server).

與其他 Database Engine 功能的互通性和共存性Interoperability and Coexistence with Other Database Engine Features

Always On 可用性群組Always On availability groups 可搭配 SQL ServerSQL Server的下列功能或元件使用:can be used with the following features or components of SQL ServerSQL Server:

警告

如需使用其他功能搭配 Always On 可用性群組Always On availability groups 之限制事項的資訊,請參閱 AlwaysOn 可用性群組:互通性 (SQL Server)For information about restrictions and limitations for using other features with Always On 可用性群組Always On availability groups, see Always On Availability Groups: Interoperability (SQL Server).

另請參閱See Also

AlwaysOn 可用性群組概觀 (SQL Server) Overview of Always On Availability Groups (SQL Server)
AlwaysOn 可用性群組的必要條件、限制和建議 (SQL Server) Prerequisites, Restrictions, and Recommendations for Always On Availability Groups (SQL Server)
設定 AlwaysOn 可用性群組的伺服器執行個體 (SQL Server) Configuration of a Server Instance for Always On Availability Groups (SQL Server)
建立及設定可用性群組 (SQL Server) Creation and Configuration of Availability Groups (SQL Server)
可用性群組的管理 (SQL Server) Administration of an Availability Group (SQL Server)
監視可用性群組 (SQL Server) Monitoring of Availability Groups (SQL Server)
AlwaysOn 可用性群組的 Transact-SQL 陳述式概觀 (SQL Server) Overview of Transact-SQL Statements for Always On Availability Groups (SQL Server)
AlwaysOn 可用性群組的 PowerShell Cmdlet 概觀 (SQL Server)Overview of PowerShell Cmdlets for Always On Availability Groups (SQL Server)