Always On 可用性组:高可用性和灾难恢复解决方案Always On availability groups: a high-availability and disaster-recovery solution

适用对象: yesSQL ServeryesAzure SQL 数据库noAzure SQL 数据仓库no并行数据仓库APPLIES TO: yesSQL Server noAzure SQL Database noAzure SQL Data Warehouse noParallel Data Warehouse

AlwaysOn 可用性组Always On availability groups 功能是一个提供替代数据库镜像的企业级方案的高可用性和灾难恢复解决方案。The AlwaysOn 可用性组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) 中引入了 AlwaysOn 可用性组Always On availability groups功能,此功能可最大程度地提高一组用户数据库对企业的可用性。Introduced in SQL Server 2012 (11.x)SQL Server 2012 (11.x), AlwaysOn 可用性组Always On availability groups maximizes the availability of a set of user databases for an enterprise. “可用性组” 针对一组离散的用户数据库(称为“可用性数据库” ,它们共同实现故障转移)支持故障转移环境。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

AlwaysOn 可用性组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. “可用性副本” 是可用性组的实例化,此可用性组由特定的 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 three synchronous-commit availability replicas, including the current primary replica.

    有关详细信息,请参阅 可用性模式(AlwaysOn 可用性组)For more information, see Availability Modes (Always On Availability Groups).

    SQL Server 2019SQL Server 2019 将同步副本的最大数目从 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). 可以配置此组的 5 个副本在该组中进行自动故障转移。You can configure this group of five replicas to have automatic failover within the group. 有 1 个主要副本以及 4 个同步的次要副本。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).

与其他数据库引擎功能的互操作性和共存Interoperability and Coexistence with Other Database Engine Features

AlwaysOn 可用性组Always On availability groups 可与以下 SQL ServerSQL Server功能和组件一起使用:can be used with the following features or components of SQL ServerSQL Server:

警告

有关通过 AlwaysOn 可用性组Always On availability groups 使用其他功能的限制和局限性的详细信息,请参阅 AlwaysOn 可用性组:互操作性 (SQL Server)For information about restrictions and limitations for using other features with AlwaysOn 可用性组Always On availability groups, see Always On Availability Groups: Interoperability (SQL Server).

相关任务Related Tasks

相关内容Related Content

另请参阅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)