温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

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

发布时间:2020-08-16 05:14:24 来源:ITPUB博客 阅读:162 作者:cow977 栏目:关系型数据库

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.

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI