Today we will learn to configure the load balancer
(Load Balancer) in the control panel vCloud Director. As the name implies, this
tool is balancing traffic web resource among multiple servers for a given
algorithm and protocol. Since the load is distributed between servers that
perform the same function (e.g., web-server), in case of failure of one of the
servers, the load will be redistributed among the remaining in service. Thus,
the balancer increases the resiliency of the site. In general, a useful thing
for websites that are hosted in the cloud, especially for online shopping.
How
does it work?
The function of the load balancer in the panel
performs a vCloud Director vShield Edge. This service acts as a translator of
addresses (NAT), it is configured Firewall, VPN, DHCP and static routing.
To
make things work, when setting prescribes the following:
Servers Pool - the IP addresses of the servers (VMs)
between which the load is balanced. At the same step, we specify the protocol
(HTTP, HTTPS, and TCP), on which the load balancer is drawn to the servers, and
the parameters for tracking the availability of virtual machines. On the basis
of this monitoring will be made the decision to redirect traffic to a running
server in case of failure.
Servers Virtual (Virtual the IP) - the external
IP-address through which users access the resources hosted on the virtual
machines (Pool Servers). Below is an exemplary diagram of how it can look for a
conditional site.
Instructions
Let's start with the configuration. At the start, we
need: - vShield Edge, which is connected to the external network. - Network-level
organization in which there are at least two virtual machines (pardon the
captaincy :)). The service of all this
is created automatically, but if you use vCloud Director somewhere else, here
are detailed instructions for setting up the network. External IP-address, or a range. See it
possible properties vShield Edge. In our case it is 92.242.44.150. I write it
somewhere. - Internal IP of virtual machines that will participate in the
balancing. To do this, go to the tab My Cloud, open the desired VM vApp c. We
are looking for desired information in the appropriate column.
So
there you go to set up:
1. Go
to section Administration and click on the virtual data center.
2. Go
to the tab Edge Gateways. Click the right button to select the Edge and Edge
Gateway Services.
3. In
the new window go to the tab Load Balancer. First, you need to add a pool of
virtual machines (servers), between which will balance the load. To do this,
click on the Pool Servers and click Add.
4. Prescribes
pool name and description if needed.
5. Next,
choose on what will be available to the server protocol (HTTP, HTTPS, and TCP),
ports and balancing method, i.e. algorithm, according to which traffic will be
shared between virtual machines. The following methods: - the IP Hash: all
requests from the same IP-address will be exposed to the same server from the
pool - Round Robin: requests are distributed in turn among servers, depending
on the desired weight. - URI: all requests to the same address will
fall on one virtual machine. Applicable only for servers that are available on
the protocol http. - Least Connected:
the new request will be routed to the least loaded server. For example, select
the protocol http, Port 80, the method of Round Robin.
6. In
the next step set the parameters on which will be monitoring the availability
of a pool of servers:
·
Port
·
Protocol
·
The interval
between calls (interval)
·
An interval
during which must be answered by the server (timeout)
·
The required
number of successful appeals ( threshold health)
·
Allowable number
of unsuccessful calls to the message server failure (unhealthy threshold). Here
you can tweak the default values, the main thing - do not overdo it and not to
put, for example, for field 1 second timeout. :) In the URI for HTTP service
indicate the address to which the balancer will check the server status. It can
be left as is (/).Esli not looking for easy ways, you can create a static web
page for each server. In this case, the 200 OK response indicates that
everything is working.
1. Next,
add the newly created pool of IP-addresses of virtual machines (Members). To do
this, click Add, and shall be pursuant to the IP addresses of machines between
which will be balanced. For example, 192.168.1.2 and 192.168.1.3.
The Ratio Weight
specify server weight balancing. If the first server, specify the weight of 1
and 2 for the second, then the second server will come in 2 times more calls. If
set to 0 - the server will not participate in the balancing.Adding a second
virtual machine and click Next.
2. On
the Ready to Complete check everything again, and click Finish.
3. Go
back to the home page and go to the tab Virtual Servers. Click Add.
4. Prescribes
the name of the virtual server.
·
In the field of
Applied On select network (outside!). In our case it cloudlite-internet-2.
·
The IP address
is assigned from the Sub-Allocated the IP Pool (the one that we saw here)
·
Select the
server pool created in the previous step.
·
If you need to
make every customer got to the server, to which he applied for the first time,
select the Persistence Method Cookie. When all added, click OK.
5. Do
not forget to click OK on the main page.
With all the balancer itself. If you have not set up
Firewall, you should do it - list the rules for him so that he missed the right
traffic (detailed instructions here).
