VMware vCloud Director Cookbook
上QQ阅读APP看书,第一时间看更新

Creating load-balanced VMs in an organization

We will now use the Edge to create load-balanced VMs.

Getting ready

You will need a deployed organizational Edge with a suballocation of at least one IP.

Please also create an Organization Network that connects to the Edge device (if you have problems, have a look at the Giving your networks an Edge recipe in Chapter 1, Setting Up Networks).

Create a vApp with two VMs in it. You will need two VMs (Windows or Linux) with a web server installed (IIS or Apache). The VMs should have IPs from the Organization Network (pool or manual). Make sure your web server is prepared and tested for load balancing. Due to the limited space, I cannot go into details on how to configure IIS or Apache for load balancing. But Google will have the answers for you.

The VMs in this vApp should be connected to the Edge via the Organization Network you created. You might like to either use manual IPs or fix the IP allocation (as shown in the Ensuring no change occurs in IP after redeployment recipe in this chapter).

With regards to licensing, the load balancing (as well as VPN and HA) features of vCNS require advanced licensing. vCNS Advanced comes with vCloud Suite Advanced or a better edition.

How to do it...

  1. Enter the organization you have created the Edge and the vApp in.
  2. Click on Cloud Resources and then double-click on the OvDC you have created.
  3. Click on Edge Gateway.
  4. Right-click on the Edge and select Edge Gateway Services.
  5. Click on Load balancer.
  6. Configure the pool servers by performing the following steps:
    1. Click on Add.
    2. Name the pool, for example, Webserver.
    3. Check HTTP (and if you want, check HTTPS; however, I will not cover this in detail).
    4. In the drop-down menu, you can select the method that shows how the connection should be distributed between the pool members, as shown in the following screenshot:
    5. In the Configure Health-Check step, we can configure what the load balancer should monitor to know if a resource is unavailable. For the moment, we can just click on Next.
    6. Now add the member servers to the pool by clicking on Add.
    7. Add the server by its IP from the Organization Network it's connected to.
    8. You can add different Port and Monitor Port values instead of the default. We are configuring HTTP so the Port value 80 is fine:
    9. After adding a second member server to the pool, review the settings and finish the wizard.
  7. Configure the Virtual Servers (also called Virtual IP (VIP)) by performing the following steps:
    1. Click on Add.
    2. Give the VIP a name.
    3. Choose whether the IP should be used from the Edge network or from the External Network (for this example, we choose the External Network).
    4. Enter the IP you want. It has to be part of the suballocation you specified for the Edge.
    5. Select the service you would like to load balance and the Persistency Method (stickiness).
    6. Finally, do not forget to check Enabled, as shown in the following screenshot:
  8. Click on OK to finish the setup and then exit the Edge configuration with OK.
  9. The Edge will now be configured. After the configuration is finished, you should be able to try an HTTP connection to the VIP you have specified.

How it works...

The Edge contains a load balancing function. This function is accessible via vCloud; however, the amount of configuration that can be done is limited. We will later show how we can configure more using vCNS. The configuration from the previous example is reflected in the following diagram:

The VIP 172.16.1.51 (from the external network) is used to load balance the HTTP (TCP port 80) service to the VMs that are configured on the Edge network.

What really happens in the background is that vCloud uses the Edge to configure the load balancing. The options for the load balancer that vCloud can set are as follows:

If you are using the HTTP cookie method, you have some additional configuration items. You can define the cookie name as well as the mode. The cookie modes available are Insert, Prefix, and App.

One of the things that vCNS doesn't do is SSL offloading; only SSL pass through is supported at this stage.

There's more...

Instead of using the vCloud/vCNS load balancer, you can also use any load balancer that is available as a VM, such as F5 and Cisco provide. If you would like to play with a load balancer, you can get 30-day trial versions from most vendors. Using other virtual load balancers gives you some more flexibility as you can insert them directly into the vApps. The disadvantage is that they may incur additional licensing.

Load balancer methods

The following load balancing methods exist:

See also