Setting Up Load Balancers
Cloud Infrastructure Automation allows your customers to create load balancers to balance incoming network traffic by distributing the workload among several cloud servers. Using this feature, customers can improve response times and reliability of their websites and online shops.
To set up the load-balancing functionality, you need to do the following:
- Create a resource for the load-balancing functionality and include it in your service template.
- Create a cloud server and install a Linux operating system in it.
- Install the load-balancing package on the server.
- Create an image from the cloud server, and configure it as the load balancer.
Once you complete these steps, customers will be able to create load balancers in their control panel. A load balancer in Cloud Infrastructure is a cloud server created from the prepared image. This server has the load-balancing software installed and serves requests for cloud servers associated with the load balancer.
Step 1. Configuring the Service Template
To be able to offer the load-balancing functionality to customers, you need to include the CI Load Balancers resource type in your service template. For more information on creating service templates for Cloud Infrastructure, see the Creating Service Template for Cloud Infrastructure section.
Step 2. Setting Up the Server
To set up a server for hosting a load balancer, you need to create a new cloud server. This server must be a container and run the 64-bit version of CentOS 6.x.
To create such a server:
- Log in to the CCP by clicking Hosting CP in Operations PCP.
- Click the Cloud Infrastructure tab, and then click New Server.
- Follow the on-screen instructions to create a container running CentOS 6.x. While creating the container:
- Leave the I will manage the OS kernel checkbox clear and select the Free Linux option in the Server Configuration group.
- Choose the 64-bit version of CentOS 6 as the operating system to install in the cloud server.
Step 3. Installing the Load-Balancing Package
Now that you have created the cloud server, you need to install the load-balancing package on it. The load-balancing functionality in Cloud Infrastructure is based on the HAProxy solution (http://www.haproxy.org) that offers high availability, load balancing, and proxying for TCP and HTTP-based applications.
To install the load-balancing package:
- Navigate to the
/os/RHEL/6/RPMS
directory in your CloudBlue Commerce distribution, and look for thehaproxy-1.4.23-106.parallels.i386.rpm
(or higher version) package. - Copy the package to the server to act as the load balancer, and install it there using the
rpm -i
command. - Once the package is installed, shut down all network services running in the load balancer, except for the
HAProxy
service.
Step 4. Creating and Configuring the Image
Next, you need to create an image from the prepared cloud server. To do this:
- Log in to the CCP by clicking the Hosting CP in CloudBlue Commerce PCP.
- Click the Cloud Infrastructure tab.
- Click the name of the cloud server you want to use as the basis for creating the image.
- Make sure that the cloud server is stopped. If it is not, stop the server by clicking Stop.
- Click Create Image.
- Specify a name for the image in the Image Name field, and type its description in the Description field.
- If custom node locations are available in your system, specify the node location where the image will be created in the Location field.
- Click Create.
- Once the image is created, click the Set as HTTP Load Balancer link next to the image to configure it as the load balancer.
Once you have created and configured the image, make sure that the CI Load Balancers resource type is included in your service template (and in your service plan). Otherwise, the load balancing functionality will not be available to your customers.