none
Question on AOAG Listeners

    Question

  • Hi,

    In my organization stretching of subnet over VLAN is strictly prohibited and not allowed. 

    So if I configure a LISTERNER .. and I failover my AOAG to a node running in another data center. I cannot take the IP address of the listener to the new node. because the IP address belongs to a subnet in the primary data center and that IP address cannot be taken to secondary data center which is running on different subnet.

    So I can see that the UI offers me that I can enter multiple IP addresses.

    But I don't understand how will it work... when primary is in DC1, the listener must use IP of DC1 and when failover happens and primary is in DC2 then the listener must use the IP of DC2.


    val it: unit=()

    Wednesday, May 22, 2013 9:06 PM

Answers

  • Your cluster will have two different networks.  On the nodes in the primary datacenter one network will be available.  On the nodes in the secondary datacenter the other network will be available.  Your AG Listener will have an OR dependency on two different IP addresses, one on each network.

    The cluster will bring one or the other IP online, then bring the network name online.  Clients will be able to connect to whichever IP is up.

    The AG Listener is a network name that is registered in DNS with both IP addresses.  Clients configured with the MultiSubnetFailover connection string parameter will try to connect to both IP addresses and use whichever one is available.  The cluster guarantees that when one IP is available the other one is not.

    David


    David http://blogs.msdn.com/b/dbrowne/


    Wednesday, May 22, 2013 9:57 PM
  • If you are using a DNS alias, you need to have two entries in your DNS that points to the virtual IP addresses on your production and your DR data center. The DNS client will have, by default, a TTL value of 20 minutes which you need to reduce. The way the client application connects to the DNS alias will depend on whether or not they have the capability to cache multiple IP addresses for the same entry. The SQL Server Native Client and ADO.NET 4.0 has the MultiSubnetFailover parameter that you can use in the connection string to retry the list of IP addresses (in this case, the IP address of the one in production and the one in DR) in its DNS client cache. A simple PING test sometimes doesn't work. You need to flush the DNS client cache in order to get the other IP addresses from the DNS server.

    A clustered network name resource will now have two virtual IP addresses, as David explained. This will use the OR dependencies where you can have multiple dependencies using the OR logic. Only one of the virtual IP addresses can be online at any given time. Check out this article, particularly the section on Understanding the OR Logic in Dependencies, for more information on how this works. While the article talks about a multi-subnet SQL Server Failover Clustered Instance, the concepts apply to Availability Groups


    Edwin Sarmiento SQL Server MVP
    Blog | Twitter | LinkedIn

    • Marked as answer by MSDN Student Thursday, May 23, 2013 6:13 PM
    Thursday, May 23, 2013 1:41 AM
    Moderator
  • Yes, except you don't have to reduce the TTL. The AG Listener DNS entry will always return both IP addresses. Newer clients with the MultiSubnetFailover connection string parameter are coded to attempt to connect to both IP addresses simultaneously.

    David


    David http://blogs.msdn.com/b/dbrowne/

    • Marked as answer by MSDN Student Thursday, May 23, 2013 6:13 PM
    Thursday, May 23, 2013 2:46 AM
  • Your understanding of DNS is incorrect.  It returns the client all registered IP addresses.  EG www.bing.com has 4 different IP addresses, 2 IPv4 addresses and 2 IPv6 addresses.

    PS C:\Users\dbrowne> nslookup www.bing.com
    Server:  UnKnown
    Address:  10.7.158.10
    
    Non-authoritative answer:
    Name:    a134.dsw3.akamai.net
    Addresses:  2001:559:0:41::6011:6f7a
              2001:559:0:41::1703:cbb
              64.208.241.66
              64.208.241.34
    Aliases:  www.bing.com

    Most clients just pick one address and connect using that. But the SqlServer client with MultiSubnetFailover behaves differently. It attempts both addresses simultaneously.

    David


    David http://blogs.msdn.com/b/dbrowne/

    • Marked as answer by MSDN Student Thursday, May 23, 2013 6:13 PM
    Thursday, May 23, 2013 5:52 PM

All replies

  • Your cluster will have two different networks.  On the nodes in the primary datacenter one network will be available.  On the nodes in the secondary datacenter the other network will be available.  Your AG Listener will have an OR dependency on two different IP addresses, one on each network.

    The cluster will bring one or the other IP online, then bring the network name online.  Clients will be able to connect to whichever IP is up.

    The AG Listener is a network name that is registered in DNS with both IP addresses.  Clients configured with the MultiSubnetFailover connection string parameter will try to connect to both IP addresses and use whichever one is available.  The cluster guarantees that when one IP is available the other one is not.

    David


    David http://blogs.msdn.com/b/dbrowne/


    Wednesday, May 22, 2013 9:57 PM
  • Can you point me to an article which explains this in details. Some question after reading your post.

    1. Suppose I have DNS alias for my cluster MYSQLFC.mycompany.com and behind this DNS alias there are multiple IP addresses (one for each data center). Now when a client connects to MYSQLFC.mycompany.com to which IP address will the DNS resolve the name? 

    in scenarios the DNS does a round robin with the registered IP addresses... but in this case round robin will not work because only one IP is up (that of the primary node).

    So how will DNS know which is the right and active IP address depending on which node is active?

    2. So if multiple IP addresses are registered one for each subnet (or data center) how will the SQL cluster know which one belongs to which node? because there is a mapping between a datacenter and a IP address. there should be some way of selecting the IP address. How will the cluster make this choice?

    3. In the connection string I will configure "server=SQLFC.mycompany.com;Database=Foo;MultiSubnetFailover =true"

    Now based on this information how will the client know what other IP addresses does the listener have? afterall I am giving only the DNS alias ... but internally there are multiple IP addresses? so how is the client coming to know of the other IP addresses?


    val it: unit=()

    Wednesday, May 22, 2013 11:22 PM
  • If you are using a DNS alias, you need to have two entries in your DNS that points to the virtual IP addresses on your production and your DR data center. The DNS client will have, by default, a TTL value of 20 minutes which you need to reduce. The way the client application connects to the DNS alias will depend on whether or not they have the capability to cache multiple IP addresses for the same entry. The SQL Server Native Client and ADO.NET 4.0 has the MultiSubnetFailover parameter that you can use in the connection string to retry the list of IP addresses (in this case, the IP address of the one in production and the one in DR) in its DNS client cache. A simple PING test sometimes doesn't work. You need to flush the DNS client cache in order to get the other IP addresses from the DNS server.

    A clustered network name resource will now have two virtual IP addresses, as David explained. This will use the OR dependencies where you can have multiple dependencies using the OR logic. Only one of the virtual IP addresses can be online at any given time. Check out this article, particularly the section on Understanding the OR Logic in Dependencies, for more information on how this works. While the article talks about a multi-subnet SQL Server Failover Clustered Instance, the concepts apply to Availability Groups


    Edwin Sarmiento SQL Server MVP
    Blog | Twitter | LinkedIn

    • Marked as answer by MSDN Student Thursday, May 23, 2013 6:13 PM
    Thursday, May 23, 2013 1:41 AM
    Moderator
  • Yes, except you don't have to reduce the TTL. The AG Listener DNS entry will always return both IP addresses. Newer clients with the MultiSubnetFailover connection string parameter are coded to attempt to connect to both IP addresses simultaneously.

    David


    David http://blogs.msdn.com/b/dbrowne/

    • Marked as answer by MSDN Student Thursday, May 23, 2013 6:13 PM
    Thursday, May 23, 2013 2:46 AM
  • >  AG Listener DNS entry will always return both IP addresses

    How is that possible? I thought when I say xyx.mycompany.com the DNS looks up all the registered IP addresses and then returns me "one" IP address.

    How can DNS return multiple IP?


    val it: unit=()

    Thursday, May 23, 2013 5:36 PM
  • Your understanding of DNS is incorrect.  It returns the client all registered IP addresses.  EG www.bing.com has 4 different IP addresses, 2 IPv4 addresses and 2 IPv6 addresses.

    PS C:\Users\dbrowne> nslookup www.bing.com
    Server:  UnKnown
    Address:  10.7.158.10
    
    Non-authoritative answer:
    Name:    a134.dsw3.akamai.net
    Addresses:  2001:559:0:41::6011:6f7a
              2001:559:0:41::1703:cbb
              64.208.241.66
              64.208.241.34
    Aliases:  www.bing.com

    Most clients just pick one address and connect using that. But the SqlServer client with MultiSubnetFailover behaves differently. It attempts both addresses simultaneously.

    David


    David http://blogs.msdn.com/b/dbrowne/

    • Marked as answer by MSDN Student Thursday, May 23, 2013 6:13 PM
    Thursday, May 23, 2013 5:52 PM