Sun Java System Application Server Enterprise Edition 8.1 2005Q2 High Availability Administration Guide

- Previous: How the Load Balancer Works
- Next: Configuring Web Servers for Load Balancing

# Setting Up HTTP Load Balancing

This section describes how to set up the Load Balancer plug-in and includes the following sections:

- Prerequisites for Setting Up Load Balancing

- HTTP Load Balancer Deployments

- Procedure to Set Up Load Balancing

## Prerequisites for Setting Up Load Balancing

Before configuring your load balancer, you must:

- Install a web server.

- Install the load balancer plug-in.

  For information on the installation procedure, see the Sun Java System Application Server Installation Guide (if using the stand-alone Application Server) or the Sun Java Enterprise System Installation Guide (if using Java Enterprise System).

- Configure the web server. For more information, see Configuring Web Servers for Load Balancing

- Create Application Server clusters or server instances to participate in load balancing.

- Deploy applications to these clusters or instances.

## HTTP Load Balancer Deployments

You can configure your load balancer in different ways, depending on your goals and environment, as described in the following sections:

- Using Clustered Server Instances

- Using a Single, Stand-Alone Instance with Load Balancer Used as a Reverse-Proxy Plug-in

- Using Multiple Stand-Alone Instances

### Using Clustered Server Instances

The most common way to deploy the load balancer is with a cluster or clusters of server instances. By default all the instances in a cluster have the same configuration and the same applications deployed to them. The load balancer distributes the workload between the server instances and requests fail over from an unhealthy instance to a healthy one. If you’ve configured HTTP session persistence, session information persists when the request is failed over.

If you have multiple clusters, requests are only load balanced and failed over between the instances in a single cluster. Use multiple clusters in a load balancer to easily enable rolling upgrades of applications. For more information, see Upgrading Applications Without Loss of Availability.

### Using a Single, Stand-Alone Instance with Load Balancer Used as a Reverse-Proxy Plug-in

You can also configure your load balancer to use stand-alone server instance instead of a cluster. This configuration results in the load balancer plug-in working as a reverse-proxy plug-in (sometimes called a pass-through plug-in). When the web server receives requests for applications enabled in the load balancer, it forwards the requests directly to the Application Server.

Use the same procedures to configure the load balancer for a pass-through plug-in as you use to configure it for a cluster of server instances.

### Using Multiple Stand-Alone Instances

It is also possible to configure your load balancer to use multiple stand-alone instances, and load balance and fail-over requests between them. However, in this configuration, you must manually ensure that the stand-alone instances have homogenous environments and the same applications deployed to them. Because clusters automatically maintain a homogenous environment, for most situations it is better and easier to use clusters.

## Procedure to Set Up Load Balancing

Use the `asadmin` tool to configure load balancing in your environment. For more information on the `asadmin` commands used in these steps, see Configuring the Load Balancer

### To Set Up Load Balancing

1. Create a load balancer configuration using the `asadmin` command `create-http-lb-config`.

2. Add a reference to a cluster or stand-alone server instance for the load balancer to manage using `asadmin` `create-http-lb-ref`.

   If you created the load balancer configuration with a target, and that target is the only cluster or stand-alone server instance the load balancer references, skip this step.

3. Enable the cluster or stand-alone server instance referenced by the load balancer using `asadmin enable-http-lb-server`.

4. Enable applications for load balancing using `asadmin enable-http-lb-application`.

   These applications must already be deployed and enabled for use on the clusters or stand-alone instances that the load balancer references. Enabling for load balancing is a separate step from enabling them for use.

5. Create a health checker using `asadmin` `create-health-checker`.

   The health checker monitors unhealthy server instances so that when they become healthy again, the load balancer can send new requests to them.

6. Generate the load balancer configuration file using `asadmin` `export-http-lb-config` .

   This command generates a configuration file to use with the load balancer plug-in shipped with the Sun Java System Application Server.

7. Copy the load balancer configuration file to your web server `config` directory where the load balancer plug-in configuration files are stored.

- Previous: How the Load Balancer Works
- Next: Configuring Web Servers for Load Balancing

- © 2010, Oracle Corporation and/or its affiliates