3

I'm fairly new to SQL Server but generally well versed in RDBMS and network topics. I'm trying to wrap my head around AlwaysOn Availability Groups. I've read a handful of articles on MSDN and Googled liberally.

I think I understand that the AAG listener appears like a service on the network, it has a hostname and/or IP address and a port number. And if you create it using SQL Server Management Studio (at least), you create it "in" the server instance which hosts the primary replica.

What I don't understand is what happens under the covers. Is the listener a thread in the server instance which hosts the primary replica? Is it a separate process? If so, does it run on the same server or elsewhere in the WFC? If it runs on the same server as the primary instance, how does the listener survive failure of that node? (The data may well be replicated to a synchronous secondary, but if I can't reach the listner, I can't be redirected to that data.)

1
  • This page on MSDN should be useful to understand what an AOAG listener is, how is configured and how it works underneath.
    – Yaroslav
    Commented Jan 9, 2016 at 2:25

2 Answers 2

2

The Availability Group Listener (AGL) is part of the AG's Windows Server Failover Cluster (WSFC) Resource. It is a Virtual Network Name with n number of IP addresses. Being in a cluster resource it will only run on a single node of the WSFC and that node will be the primary node of the AG. It is not a thread within SQL Server. The WSFC handles the failover of the AG resource and the AG databases will not come online without the AG resource residing on its node of the WSFC.

The listener just handles connection forwarding. When connecting to the read/write replica the connection will hit the listener and then the listener will tell the client to connect to the primary replica's IP address. In the case of read-only routing it will follow the below work flow.

read-only routing work flow

1

The way I try to explain it to people is that the listener leverages the Windows Failover Cluster for its functionality; you cannot create the listener without the cluster already existing as the cluster itself creates the listener. As such, it is Active Directory (AD) that hosts it and the nodes that use the cluster can use any services that cluster has, in this case the listener.

So essentially someone creates the cluster, and if there are proper AD permissions then it creates the Availability Group (AG) within the cluster, and then the listener within the AG when those are created.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.