2

We have multiple instances on single node of the AlwaysOn setup, all are configured as AOAG. Right now we are connecting using the Listener\InstanceName. The listeners for each AG is having a dedicated port designated. This is why we cannot connect just by using the Listener without the port or InstanceName.

I wanted to configure in such a way that just giving the AG_Listener would be enough to connect without using the port explicitly.

Example : AG-SQL001 instead of AG-SQL001,Port_Number

Can this be done ? If yes then how?

  • I doubt if you can do that if you using different port for each listener. This article might help. blogs.msdn.microsoft.com/sqlcat/2014/02/03/… – SqlWorldWide May 1 '18 at 16:49
  • You can use multiple IP addresses (in fact you have to if you want the listeners to be independent), but I would make it a habit to use different ports and specify them in the clients anyway. – eckes May 1 '18 at 22:36
  • @eckes Agree on the port part. My current env has lots of blunders that I am figuring out and fixing.First thing is to remove the listener\InstanceName connection string from all applications and adding Listener,Portnumber. However, I wanted to test this scenario as well. – Ramakant Dadhichi May 2 '18 at 7:16
  • 1
    @SqlWorldWide Right. I will try using the same default port for listener while dedicated port for sql server instance. – Ramakant Dadhichi May 2 '18 at 7:21
4

Right now we are connecting using the Listener\InstanceName

The listener does not actually interact with the Browser service, and thus I wouldn't use this way with a listener - ever.

I wanted to configure in such a way that just giving the AG_Listener would be enough to connect without using the port explicitly.

Set the listener for port 1433. The listener uniquely identifies the instance of SQL Server and there can be multiple listeners all using 1433 as each listener has a unique IPv4 and/or IPv6 address. Note that there are other means to which SQL Server can be connected through when there are multiple instances on the same server which may or may be appropriate or correct ways of connecting.

| improve this answer | |
  • Thank you Sean. I have recently joined this env and trying to correct things.Listener\InstancsName is a bad practice and I have reported. I just got confused by instance listener ans AG listener in the documentation "If one of the instances of SQL Server is already listening on TCP port 1433 via the instance listener and there are no other services (including additional instances of SQL Server) on the computer listening on port 1433, this will not cause a port conflict with the availability group listener." – Ramakant Dadhichi May 2 '18 at 6:54
  • Now ,if I make the AG listener port to 1433, should the instances have static port defined or Dynamic port will be fine ? I believe if static port is not defined on the instance then the listener might connect to same instance even with different listener. Will test this soon but just need more info. – Ramakant Dadhichi May 2 '18 at 6:56
  • 2
    @RamakantDadhichi I wouldn't use dynamic ports but instead define a static port. If it's a single instance on the server, 1433 is fine. If there are multiple instances you'll need to use different ports for the instances themselves but the listeners can be 1433 for all. – Sean Gallardy - Retired User May 2 '18 at 12:18
  • Thanks a lot Sean, now I am confident enough on my basic.That helps.. :) – Ramakant Dadhichi May 2 '18 at 12:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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