Why we need LB for Always on SQL - Azure

This question used to bother me alot that why we need Load Balancer for Always on SQL on Azure VM as we can configure just like on-premises sql cluster. My assumption was always-on is itself load balanced or do the trick internally we only need to configure the listener ip to the web app. However when I first set up the always-on on Azure VM  by following the MS docs i created the ILB with static IP which is same as listener ip of Sql cluster.

After doing a lot of research i figured it out and would like to share it with all -

"Cloud doesnt allow Broadcast for security reasons, doesnt matter Azure , AWS or GCP"

To make it simple or more clear check this out -

We have primary and secondary node in the Always -on and whenever the fail-over task happens there is broadcast happens.

New primary replica should request and configure availability group listener IP address on its NIC whenever fail-over task happens.

After the Fail-over task, new primary replica broadcasts a request for listener Ip address & all devices receiving the request will update their ARP tables to map the physical address or MAC address of the node.

 ARP = "Address Resolution Protocol" is a request-response protocol used to resolve MAC addresses with an IP address.

Essence of the story there is a broadcast activity happens in sql always-on AV-gp which is not allowed in Cloud hence the ILB - check below for further info

As discussed above to work around this behavior we need ILB as subject of this post suggested. Internal LB associated with a Vnet and has a front-end IP address & this IP address serves as a entry point for application connections.

There is also a back-end pool that associates the VM's with the ILB , allowing traffic to flow from frontend IP address to these VM's. To determine which machine is the primary replica, ILB probes each virtual machines on a user defined port, allowing the ILB to route the subsequent connections to the one that responds.

Internal LB that we use must have Static IP which is exactly same as Listener in SQL AV-group.
During ILB configuration we select floating IP which gives the port reuse flexibility.

reference links -

https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sql/virtual-machines-windows-portal-sql-ps-alwayson-int-listener

https://docs.microsoft.com/en-us/azure/load-balancer/load-balancer-multivip-overview

2 comments:

MS Defenders

 Microsoft Defender offers a wide range of security solutions, similar to the ones we've discussed (Defender for Containers, Defender fo...