1

We have a multi-subnet AlwaysOn availability group. There are 2 subnets and those are listed on the cluster and also the listener. Whenever I fail over and ping by the listener name it still shows the old IP address before failover. Any expert opinion to get over this will be greatly appreciated. I have set the RegisterAllProvidersIP -Value 1.

After failover the client does not connect as the listener is picking up the old IP address. After a couple of minutes it picks up the correct one and the client connects.

3

This behavior occurs due to the time to live (TTL) on the DNS records. A client does not do a DNS lookup every time it attempts to connect to a server. It first looks in its DNS cache to see if there is a cached entry. You can see what is in the cache by running ipconfig /displaydns. Once you run this you'll see the "Time To Live" property on each record. This indicates how many more seconds the record will stay cached.

So your client will not connect to the new IP address until the old record is timed out of the cache. If you dig into the Microsoft documentation, they recommend setting the time to live on listener DNS records to 5 minutes to minimize this delay.

Additionally, if the SQL client in use supports "multi-subnet failover", you need to enable that option. When this option is enabled, the client will try to connect to all IP addresses that are registered for the listener name. So for this to work nicely, you will have both IP addresses registered for the listener hostname at all times.

See SQL Server Multi-Subnet Clustering (SQL Server)

  • Thanks I was able to see the TTL and exactly the client connected after that time elapsed. So the conclusion is there will be some lag when failing over to a different subnet. I really appreciate your expertise on this.... – SQL_NoExpert Feb 15 at 19:26
  • Is there any way i can force to grab the new ip instead of waiting for the old record to be timed out from the cache and then get the new IP – SQL_NoExpert Feb 19 at 15:34

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.