This question is about the correct way of accessing an Availability Group Listener?
Assume I have two AlwaysOn Availability Groups with the following AG's: AG1
and AG2
.
I also have 2 listeners called LISTENER1
(on AG1) and LISTENER2
(on AG2).
I have 2 SQL nodes NODE1
and NODE2
and both have 2 SQL instances running: INSTANCE1
and INSTANCE2
.
How do I correctly connect to the primary replica of AG1
via the listener?
I know it's not supposed to be NODE1\INSTANCE, but which of the following is correct?
LISTENER1
or
LISTENER1\INSTANCE1
I noticed both work fine and I assume the latter connects to the primary replica of LISTENER1 and than lets SQL Browser do its magic and connects to INSTANCE1 (which - by luck - happens to be correct in this particular setup).
I noticed if I use LISTENER1\INSTANCE2, this works as well, BUT connects to the INSTANCE2 instance of the node which hosts the primary replica of AG1!
The rabbit hole goes even futher: if I install a default instance on both SQL nodes I get yet another behavior: Connecting to LISTENER1
, connects me to the default instance.
Is my logic correct (SQL Browser service) or am I just completely wrong here?
FYI: Named instances in this case use dynamic ports and all listeners are hosted on port 1433