View blogs by industry experts on topics such as SSAS, SSIS, SSRS, Power BI, Performance Tuning, Azure, Big Data and much more! You can also sign up to post your own business intelligence blog.
With AlwaysOn Availability Groups (AG), you can fail a group of databases over to another node. You may be wondering how to configure your application so that it always connects to the primary replica of the database – the replica that allows writes as well as reads.
The good news is that there is no special connection string or application configuration that you must implement for redirection with AG. When setting up AG, you configure a listener which is a virtual name that always points to the primary replica. This listener is actually a cluster resource that fails over along with the databases. (Note: The nodes where SQL Server is installed must be part of a Windows cluster, however, SQL Server does not need to be clustered.)
When looking at Cluster Manager, I can see that my AG group and the listener are cluster resources.
When looking at Management Studio, I can see the listener and reconfigure the IP address, if necessary.
When creating my connection string for the application, I use AG1_Listener in place of the actual server name. Even if there is a failover, the application will always connect to the correct node.