返回顶部
首页 > 资讯 > 数据库 >[AlwaysOn] 创建SQL Server高可用性组T-SQL语法:PRIMARY_ROLE子句
  • 893
分享到

[AlwaysOn] 创建SQL Server高可用性组T-SQL语法:PRIMARY_ROLE子句

2024-04-02 19:04:59 893人浏览 独家记忆
摘要

PRIMARY_ROLE ( ... ) 指定当此可用性副本当前拥有主要角色(即,无论何时为主要副本)时生效的特定于角色的设置。Specifies role-specific settings tha

PRIMARY_ROLE ( ... )

指定当此可用性副本当前拥有主要角色(即,无论何时为主要副本)时生效的特定于角色的设置。Specifies role-specific settings that take effect if this availability replica currently owns the primary role (that is, whenever it is the primary replica). 在括号内,指定一个或两个主要角色选项。Within the parentheses, specify either or both primary-role options. 如果两者都指定,请使用逗号分隔的列表。If you specify both, use a comma-separated list.

主要角色选项如下:The primary role options are as follows:

ALLOW_CONNECTIONS = { READ_WRITE | ALL }

指定执行主要角色(即充当主要副本)的给定可用性副本的数据库可以从客户端接受的连接类型,其中之一:Specifies the type of connection that the databases of a given availability replica that is perfORMing the primary role (that is, is acting as a primary replica) can accept from clients, one of:

READ_WRITE

不允许将应用程序意向连接属性设置为只读的连接。Connections where the Application Intent connection property is set to ReadOnly are disallowed. 当Application Intent属性设置为ReadWrite或未设置Application Intent连接属性时,允许进行连接。When the Application Intent property is set to ReadWrite or the Application Intent connection property is not set, the connection is allowed.有关应用程序意向连接属性的详细信息,请参阅将连接字符串关键字用于SQL Server本机客户端。For more information about Application Intent connection property, see Using Connection String KeyWords with sql Server Native Client.

ALL

允许所有连接到主副本中的数据库。All connections are allowed to the databases in the primary replica. 这是默认行为。This is the default behavior.

READ_ONLY_ROUTING_LIST = { ('<server_instance>' [ ,...n ] ) | NONE }

指定在辅助角色下运行时承载此可用性组的可用性副本并满足以下要求的服务器实例的逗号分隔列表:Specifies a comma-separated list of server instances that host availability replicas for this availability group that meet the following requirements when running under the secondary role:

l   配置为允许所有连接或只读连接(见上文辅助角色选项的“允许连接”参数)。Be configured to allow all connections or read-only connections (see the ALLOW_CONNECTIONS argument of the SECONDARY_ROLE option, above).

l   定义其只读路由URL(见上文辅助角色选项的只读路由URL参数)。Have their read-only routing URL defined (see the READ_ONLY_ROUTING_URL argument of the SECONDARY_ROLE option, above).

只读路由列表值如下:The READ_ONLY_ROUTING_LIST values are as follows:

<server_instance> 指定作为副本主机的SQL Server实例的地址,该副本在辅助角色下运行时是可读的辅助副本。<server_instance> Specifies the address of the instance of SQL Server that is the host for a replica that is a readable secondary replica when running under the secondary role.

使用逗号分隔的列表指定可能承载可读的辅助副本的所有服务器实例。Use a comma-separated list to specify all the server instances that might host a readable secondary replica. 只读路由遵循在列表中指定服务器实例的顺序。Read-only routing follows the order in which server instances are specified in the list. 如果在副本的只读路由列表中包含副本的主机服务器实例,那么将此服务器实例放在列表末尾通常是一个好的做法,这样,如果有可用的话,读意向连接将转到辅助副本。If you include a replica's host server instance on the replica's read-only routing list, placing this server instance at the end of the list is typically a Good practice, so that read-intent connections go to a secondary replica, if one is available.

从SQL Server 2016(13.x)开始,您可以在可读的辅助副本之间负载平衡读意向请求。Beginning with SQL Server 2016 (13.x), you can load-balance read-intent requests across readable secondary replicas. 您可以通过将副本放置在只读路由列表中一组嵌套的圆括号中来指定这一点。You specify this by placing the replicas in a nested set of parentheses within the read-only routing list. 有关更多信息和示例,请参阅跨只读副本配置负载平衡。For more information and examples, see Configure load-balancing across read-only replicas.

注释 NONE

指定当此可用性副本是主副本时,不支持只读路由。Specifies that when this availability replica is the primary replica, read-only routing is not supported.这是默认行为。This is the default behavior.

您可能感兴趣的文档:

--结束END--

本文标题: [AlwaysOn] 创建SQL Server高可用性组T-SQL语法:PRIMARY_ROLE子句

本文链接: https://lsjlt.com/news/49665.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作