Sql-server – when can AG primary replica be a different host to WFC primary

availability-groupsclusteringsql serversql-server-2012

To set up an Availability Group with two servers, the servers both participate in a Windows Failover Cluster.

I've seen cases after certain failover modes where the primary IP address in the cluster (in Windows Server Manager -> Failover Cluster Manager -> Cluster Core Resources) can be the address associated with the secondary replica in the AG.

Is this a problem – does it matter at all?

More generally, is there any reference on how the WFC relates to the AG, and to the Availability Group Listener?

Best Answer

This is easiest to explain if you think about having multiple Availability Groups in your environment rather than just one. Each AG listener would have its own name and IP, and it could be failed over independently to either physical node.

In that environment, there are a few different parts:

  • The physical nodes - each of which has its own IP address
  • Each Availability Group listener - each of which has its own virtual name and address, and fails over back and forth between the nodes depending on who owns that particular Availability Group at that moment in time
  • The cluster's management point - which also has its own virtual name and address, and can be different than the AG listener.

See, one of the nodes has to own the cluster. This becomes more and more important as your cluster grows out - for example, to multiple physical nodes rather than just two. That cluster manager keeps control of the cluster's state, which nodes own which moving parts, and so on.

All Windows clusters - even a simple 2-node, 1-AG setup - have this separate name and IP address for management. Most of the time, it doesn't matter who owns the cluster, but in a multi-node cluster (say, 3 nodes in your primary data center and 2 nodes in your disaster recovery data center) where you want to get down to last-man-standing as things fail, then it does start to matter.