Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

[AlwaysOn] create SQL Server high availability group T-SQL syntax: PRIMARY_ Role clause

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

PRIMARY_ROLE (...)

Specifies the role-specific settings that take effect when this availability copy currently has a primary role (that is, whenever it is a primary copy). Specifies role-specific settings that take effect if this availability replica currently owns the primary role (that is, whenever it is the primary replica). In parentheses, specify one or two primary role options. Within the parentheses, specify either or both primary-role options. If both are specified, use a comma-separated list. If you specify both, use a comma-separated list.

The main role options are as follows: The primary role options are as follows:

ALLOW_CONNECTIONS = {READ_WRITE | ALL}

Specifies the type of connection that a database that performs a given availability copy of the primary role (that is, acting as a primary replica) can accept from the client, one of which is: 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

Setting the application intent connection property to read-only connections is not allowed. Connections where the Application Intent connection property is set to ReadOnly are disallowed. Connections are allowed when the Application Intent property is set to ReadWrite or when the Application Intent connection property is not set. When the Application Intent property is set to ReadWrite or the Application Intent connection property is not set, the connection is allowed. For more information about application intent connection properties, see using the connection string keyword for SQL Server Native clients. For more information about Application Intent connection property, see Using Connection String Keywords with SQL Server Native Client.

ALL

Allows all connections to databases in the master replica. All connections are allowed to the databases in the primary replica. This is the default behavior. This is the default behavior.

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

Specifies a comma-separated list of server instances that host availability copies of this availability group when running under the secondary role and meet the following requirements: 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 is configured to allow all connections or read-only connections (see the allow connections parameter of the secondary role option above). Be configured to allow all connections or read-only connections (see the ALLOW_CONNECTIONS argument of the SECONDARY_ROLE option, above).

L defines its read-only routing URL (see the read-only routing URL parameter of the secondary role option above). Have their read-only routing URL defined (see the READ_ONLY_ROUTING_URL argument of the SECONDARY_ROLE option, above).

The read-only route list values are as follows: The READ_ONLY_ROUTING_LIST values are as follows:

Specifies the address of the SQL Server instance as the replica host, which is a readable secondary copy when running under the secondary role. 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 server instances that may host readable secondary copies. Use a comma-separated list to specify all the server instances that might host a readable secondary replica. Read-only routes follow the order in which server instances are specified in the list. Read-only routing follows the order in which server instances are specified in the list. If the host server instance of the replica is included in the copy's read-only route list, it is usually a good practice to place this server instance at the end of the list so that, if available, the read intention connection goes to the secondary copy. 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.

Starting with SQL Server 2016 (13.x), you can load balance read intent requests between readable secondary copies. Beginning with SQL Server 2016 (13.x), you can load-balance read-intent requests across readable secondary replicas. You can specify this by placing the copy in a set of nested parentheses in the read-only route list. 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 configuring load balancing across read-only copies. For more information and examples, see Configure load-balancing across read-only replicas.

Comment NONE

Specifies that read-only routing is not supported when this availability copy is the master copy. Specifies that when this availability replica is the primary replica, read-only routing is not supported. This is the default behavior. This is the default behavior.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report