Sql-server – SQL Availability Groups: Can clients use cluster name instead of listener name(s)

availability-groupslistenersql server

When using Availability Groups, is it possible to simply just configure all clients/applications to connect to the database(s) by using the cluster name/IP instead of the AG listener for the AG that the database resides in?

If it is possible, would it be advised against?

Example:

  • 3 node cluster with cluster name of "SQLCLUSTER2014" and cluster IP of 10.0.1.10
  • 2 nodes located at main site, one node off site at a DR site
  • 2 AG's, with listeners called "AG1_LISTENER" and "AG2_LISTENER"
  • Create a DNS A record for "SQLCLUSTER" that points to 10.0.1.10 (the cluster IP)
  • Configure all clients/application to point to "SQLCLUSTER" in their connection string

So when you upgrade to SQL 2016 and move your databases to the new server, you can just point your A record to the new cluster IP and not have to change connection strings in applications.

It seems like this would be a better setup because it allows you to utilize DNS CNAME's or A records to mask server moves, which I've done to great success on systems that don't use AG's.

Is there any reason not to do this?
Any potential issues reaching the DR site if the 2 main nodes go offline?

Thanks.

Best Answer

First, when using AGs, you generally are not using a clustered instance of SQL Server, you are using multiple standalone SQL Servers. You are able to technically connect to each individual SQL Server in the Windows Cluster Separately. Each having their own configuration and resources.

Secondly, each group has its own name in AD as a computer object and its own IP address. These are registered in DNS. These are different than the cluster name. The listener name is a special object to route traffic based on incoming query type. For instance, if you configured your AG to use a secondary node for read only queries, the listener name is what routes that query to the secondary node, not the cluster group. Backups are also attached to that listener name for routing traffic from the primary to the secondary node.

If you are monitoring AG health, it will be based off of the listener name/object, not the cluster name. It is possible to have a 3 node windows cluster, but only have an AG involving 2 nodes. The cluster name would not properly handle that.

Adding further complexity to this question. With SQL 2016, you have distributed availability groups which uses separate clusters on different networks or domains. Those separate clusters are clusters all to them selves and are only joined via the listener name for failover purposes.

Lastly, if you chose to extend your AG to Azure, you will need to use the listener when connecting to the "active" database so your query can route to the appropriate node. The cluster resource name does not know about the Azure secondary node.