Skip to main content

Azure Load balancer

Important Terms:

Azure load balancer overview
Load balancing provides a higher level of availability by spreading incoming requests across multiple virtual machines.
An Azure load balancer is a Layer-4 (TCP, UDP) load balancer that provides high availability by distributing incoming traffic among healthy VMs. A load balancer health probe monitors a given port on each VM and only distributes traffic to an operational VM.
You define a front-end IP configuration that contains one or more public IP addresses. This front-end IP configuration allows your load balancer and applications to be accessible over the Internet.
Virtual machines connect to a load balancer using their virtual network interface card (NIC). To distribute traffic to the VMs, a back-end address pool contains the IP addresses of the virtual (NICs) connected to the load balancer.
To control the flow of traffic, you define load balancer rules for specific ports and protocols that map to your VMs.



Configuring Load Balancer on Azure

Creating the Load Balancer:


  1. Sign in to Azure Portal.
  2. Select Create a resource > Networking > Load Balancer on the top left of the screen.

3. In the Create load balancer select the details, for resource select the one which you have created in the last session.

4. Under instance details give a name for your choice and select the region South India.

5. Under public IP address select create new and give the IP address name for your choice and click on Review + Create.




6. Once your validation gets paused then select Create.


Creating a Backend Address Pool:


To distribute traffic to the VMs, the load balancer uses a back-end address pool. The backend address pool contains the IP addresses of the virtual network interfaces (NICs) that are connected to the load balancer.
To create a back-end address pool that includes VM1 and VM2:
  1. Open the load balancer that you have created.
  2. Under Settings, select Backend pools, and then select Add. 


3. On the Add a backend pool page, type or select the following values:

  • Name: Type BackEndPool.
  • Associated to: Drop down and select Availability set.
  • Availability set: Select AVSetSouthIndia
  • 4.Select Add a target network IP configuration.
  • Add each virtual machine (MyVM1 and MyVM2) that you created to the back-end pool.
  • After you add each machine, drop down and select its Network IP configuration. 5.Select OK. 


6. On the Backend pools page, expand MyBackendPool and make sure both VM1 and VM2 are listed. 


Creating a Health Probe:


To allow the load balancer to monitor VM status, you use a health probe. The health probe dynamically adds or removes VMs from the load balancer rotation based on their response to health checks.
To create a health probe to monitor the health of the VMs:
  1. Under Settings of load balancer, select Health probes, and then select Add.

2. On the Add a health probe page, type or select the following values:


  • Name: Type HealthProbe.
  • Protocol: Drop down and select HTTP.
  • Port: Type 80.
  • Path: Accept / for the default URL. You can replace this value with any other URL.
  • Interval: Type 5. Interval is the number of seconds between probe attempts.
  • Unhealthy threshold: Type 2. This value is the number of consecutive probe failures that occur before a VM is considered unhealthy. 

  • 5. Select OK.


Creating a NAT Rule:


To create NAT rule:
  1. Under Settings of Load Balancer, select Inbound NAT Rules, and then select Add.

2 . Give a name for the rule and select the load balancer IP. Select the protocol as HTTP. For Port give the value as 3441 and select Target Virtual Machine as VM2 and then select its Network IP configuration. Choose Custom for port mapping and give target port value as 3389


3. You can now find a rule. Again, click on Add button to add rule for VM2.


4. Give a name for the rule and select the load balancer IP. Select the protocol as HTTP. For Port give the value as 3442 and select Target Virtual Machine as VM2 and then select its Network IP configuration. Choose Custom for port mapping and give target port value as 3389.   


5. These two rules will help for sharing load between VM1 and VM2 by network address translating incoming user request. 


Creating a load balancer rule:


A load balancer rule defines how traffic is distributed to the VMs. The rule defines the front-end IP configuration for incoming traffic, the back-end IP pool to receive the traffic, and the required source and destination ports.
The load balancer rule named LBRule listens to port 80 in the frontend LoadBalancerFrontEnd. The rule sends network traffic to the back-end address pool BackEndPool, also on port 80.
To create the load balancer rule:
  1. Select All resources on the left menu, and then select SouthIndia_LB from the resource list.
  2. Under Settings, select Load balancing rules, and then select Add. 
3. On the Add load balancing rule page, type or select the following values:
  • Name: Type LBRule.
  • Frontend IP address: Select SouthIndia_LBIP.
  • Protocol: Select TCP.
  • Port: Type 80.
  • Backend port: Type 80.
  • Backend pool: Select SouthIndiaBackendPool.
  • Health probe: Select HealthProbe.
  • 4 .Select OK.  

5. You can find the rule that was added now.


6. Go to the overview page at the Load Balancer menu and copy the IP address and ping it in the browser. Now you can see that the load is balancing for both VM1 and VM2. While refreshing you can see the change. 


Now, you are all set with load balancer configured for VM1 and VM2 in South Indian datacentre. Now the incoming user requests will be equally sent to VM1 and VM2.

Below is the output.




Thank you for visiting our blog.

For Azure, AWS and GCP Training classes in Pune, Mumbai, Thane, click here

Below are some awesome books, you must buy.

Comments

Popular posts from this blog

SAN - STORAGE AREA NETWORK - where to start (for beginner)

Hi, Welcome to our blog. This article focuses on basics of SAN which will help you to understand role of SAN in Data Centers and in cloud environment. SAN (Storage Area Network) Definition - It is a network which provides faster input output of data with redundancy and also provides space to store data Advantages - 1. Faster IO ....(Min. 1Gbps - Max 32 Gbps speed) Note- Gbps (Giga Bit Per Second) it is unit to major speed of SAN infrastructure. 2. Redundancy 3. Security 4. Centralized Management of data 5. Serverless Backup 6. LAN Free Backup 7. Scalability 8. N. number of server connection 9. Heterogeneous data Storage 10. BLOCK Level Access 11. High Availability Disadvantage - Costly - compared any other IT technologies this technology is costly SAN it is heart of data center. For any customer data is very important and SAN meets all requirements of the customer. Without SAN we can not imagine Data center even cloud also. Now a Days Cloud Technolo...

How to create Azure Virtual Machine

Hi, Welcome to Our Blog. Before Creating Azure Virtual Machine, Lets understand few important terms. Azure Virtual Machine: Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized hardware, software, or a combination. Azure Virtual Machines gives you the flexibility of virtualisation for a wide range of computing solutions—development and testing, running applications and extending your datacenter. It is the freedom of open-source software configured the way you need it. It is as if it was another rack in your datacenter, giving you the power to deploy an application in seconds instead of weeks. Azure Virtual Network: Azure Virtual Network enables many types of Azure resources, such as Azure Virtual Machines (VM), to securely communicate with each other, the internet, and on-premises networks. A virtual network is scoped to a single region; however, multiple virtual networ...