Sql-server – Read Scale Availability Groups and Listener

availability-groupslistenersql server

Is it possible to use a listener with a read scale availability group?

I have read on some sites you cannot use one but in others that you can.

If so, what IP address do you use for it? I have tried to assign a new one in the subnet and also using the IP of the VM with the primary replica. I can create the listener but cannot connect to it.

I am interested in using the listener to only connect to the primary replica, I am not planning to use read-only routing. My idea to use a read scale AG is to provide a limited degree of DR. I understand the listener would have to be redeployed if the AG was failed over.

Best Answer

Is it possible to use a listener with a read scale availability group?

Yes. Not to put a "The answer is in the blog" answer, but I did write it and it apparently survived the Blog migration fiasco. So, the answer is in this blog...

The requisite excerpt is:

Please Note: When creating the listener, you'll need to use the IP Address of the primary node. Since this does not use WSFC, any failovers will need to have the listener dropped and re-created with the current primary node's IP address to properly read only route.

I can create the listener but cannot connect to it.

Again, the requisite information from my post:

Then we get to the listener, which I will be using the local node's IP address and default port. The value of this may not even matter if it won't be registered in DNS based on what the use cases are.

Since SQL Server doesn't create DNS records (that's the job of the network name resource in WSFC) you'll need to manually create one and manually update it should you have a failover. The Listener only facilitates the need for read only routing. If you're not using read only routing then there isn't any point to creating a listener.

I am interested in using the listener to only connect to the primary replica, I am not planning to use read only routing.

Then if you continue to want to use a read-scale AG and not a WSFC based one (or Pacemaker/etc.) then you'll want to have a load balancer in front of the read-scale AG that can do scripted health checks to know which IP is the primary and is healthy. Otherwise, don't use read-scale AGs.