SQL Server Always On Listener Configuration and Function

Source: Internet
Author: User

In sqlserver 2012 always on, we can create an availability group listener to provide client connections to the database of the given availability group. The availability group listener is a virtual network name (vnn) that the client can connect to access
The database in the primary or secondary replica of the alwayson availability group. The availability group listener allows the client to connect to an availability copy (equivalent to the virtual
Server name ). You can connect to the current location of the current primary copy without modifying the client connection string.

 

Availability group Listener Configuration

 

The availability group listener is defined:

· Virtual Network Name (vnn)

· Listener port (Listening for incoming requests based on the listener name)

· One or more virtual IP addresses (VIP) configured for one or more subnets that can be faulty to the availability Group)

· Configure to use DHCP or static IP

 

Below is the always on
Listener Configuration:

 

 

After the configuration is complete, use listenner AG1 to connect to the database and view the server name (the Connected Server is node1 ):

 

 

 

Perform a Failover and query the name of the Connected Server (the actual connection to node2 is displayed, which is the same as that of the cluster ):

 

 

 

Connect to the master copy using a listener

To use the availability group listener to connect to the primary replica for read/write access, the connection string should specify the DNS name of the availability group listener. If the master replica of the availability group changes to a new replica, the existing connection using the Network Name of the availability group listener is disconnected. Then, the new connection to the availability group listener is directed to the new master copy. For
An example of the basic connection string of the ADO. Net access interface (system. Data. sqlclient:

 
Server=tcp: AG1,1433;Database=MyDB;IntegratedSecurity=SSPI

You can still select the name of the SQL server instance that directly references the primary or secondary replica without using the name of the availability group listener server, the advantage of new connections (automatically directed to the current primary copy) will be lost. It also loses the advantage of read-only routing.

 

If the availability group has only one secondary replica and is not configured to allow read access to the secondary replica, the client can connect to the primary replica by using the database image connection string.
This method may be useful when migrating existing applications from database images to availability groups, you only need to limit the availability group to two availability copies (one master copy and one secondary copy ).
To add other secondary replicas, you need to create an availability group listener for the availability group and update your application to use the DNS name of the availability group listener.

 

More information reference: http://msdn.microsoft.com/zh-cn/library/hh213417.aspx

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.