I have a cluster-less AG (read scale AG) without a listener.
Our network admin has set DNS entry to point to primary node. All applications use that DNS name for database connections.
Post failover our network team edits the DNS records to point to the new primary node.
I'm reading about adding listener to the AG and understand the purpose of it being connectivity to readable secondary via read intent in the connection string.
It seems that the listener must be pointed to the primary node ip (is this when creating the listener or is this in the DNS?).
And after failover, the listener IP must be updated to point to the new primary node IP (is this in the listener settings or in the DNS?)
I did a right click on the AG listener folder and have setup a listener with name test_listener and the IP of the current primary node (is this correct or do I have to give a new IP here?). However I'm unable to connect using this listener, the error indicates that it's not present on the network. Does this listener name also need to be registered in the DNS manually with IP of current primary node? Does this mean network team now will have to maintain 2 entries to point to the current primary? One existing and the other for the listener?
Interestingly, read intent redirection to readable secondary works even without using the listener (all I need to do is use the primary server name/ip and specify read intent and db name, and the query gets redirected to the secondary node). So what purpose does a listener serve in a read scale AG?
1 Answer 1
It seems that the listener must be pointed to the primary node ip [...]
Correct.
And after failover, the listener IP must be updated to point to the new primary node IP [...]
Correct.
However I'm unable to connect using this listener, the error indicates that it's not present on the network.
Connect using the node name/DNS entry. The listener doesn't actually exist on the network (it doesn't register anything with DNS) and it's not meant to for Read Scale.
Does this listener name also need to be registered in the DNS manually with IP of current primary node?
Nope.
Does this mean network team now will have to maintain 2 entries to point to the current primary?
No, it means Read Scale is a lot more trouble than it is generally worth. You only need to drop and re-add the listener upon failover.
-
1I still don't understand what is the purpose of setting up a listener in this case. If I setup listener with name XYZ and IP of primary, and no one can connect to the listener from their SSMS using the name XYZ, then what purpose does the listener serve?variable– variable2024年06月09日 01:28:43 +00:00Commented Jun 9, 2024 at 1:28
-
None. The listener only helps to redirect connections to AG replicas in a cluster. It's purpose is to create a listening TCP/IP socket only on the node hosting the primary replica, so clients can use a single hostname to connect.David Browne - Microsoft– David Browne - Microsoft2024年06月09日 15:14:11 +00:00Commented Jun 9, 2024 at 15:14
-
David is correct, in Read Scale it has no purpose as a listener. You need to set it up so that read only routing prerequisites are satisfied. @variableSean Gallardy– Sean Gallardy2024年06月10日 09:49:15 +00:00Commented Jun 10, 2024 at 9:49
-
I tried that without a listener also I can connect to readable secondary by connecting to primary with readintent and an AG db name. So I'm not understanding what is the need of listener at all.variable– variable2024年06月10日 12:54:08 +00:00Commented Jun 10, 2024 at 12:54
-
1@variable then something else is incorrect in your setup. That's not how it works and requires the listener. I cannot reproduce your findings and the Docs don't agree with you.Sean Gallardy– Sean Gallardy2024年06月12日 10:10:38 +00:00Commented Jun 12, 2024 at 10:10
Explore related questions
See similar questions with these tags.