Sun GlassFish Enterprise Server v2.1.1 High Availability Administration Guide

Procedure to Set Up HTTP Load Balancing

Use the Admin Console GUI or the asadmin tool to configure load balancing in your environment. The following sections provide you more information.

ProcedureTo Set Up Load Balancing Using the Admin Console

  1. Create a load balancer configuration.

    In the Admin Console, on the left frame, click HTTP Load Balancers and then click New. In the New HTTP Load Balancer page, provide the device details and also select the target cluster or instances.

  2. Add a reference to a cluster or stand-alone server instance for the load balancer to manage.

    To do this using the Admin Console, on the left frame, click the HTTP Load Balancers node and then click the desired load balancer listed under the node. Open the Targets tab, click Manage Targets and in the Manage Targets page, select the required target.

    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.

    To enable a stand-alone server instance using the Admin Console, on the left frame, click the HTTP Load Balancers node and then click the desired load balancer listed under the node. Open the Targets tab and in the Targets table, click the check box next to the instance you want to enable and click Enable.

    To enable a server instance in a cluster, select the load balancer as explained above and in the Targets tab, click the desired cluster. Now open the Instances tab, select the desired instance, and from the Load Balancer Actions drop down list, select Enable Load Balancing.

    The equivalent command to enable a cluster or a stand-alone instance is asadmin enable-http-lb-server.

  4. Enable applications for load balancing.

    To do this using the Admin Console, open the Targets tab as mentioned above and click the required cluster. Now, open the Applications tab, select the required application and from the More Actions drop-down list, and select Load Balancer Enable.

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

  5. Create a health checker.

    To do this using the Admin Console, open the Targets tab for the load balancer as mentioned in the previous step and in the Targets table, click Edit 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.


    Note –

    If you are using Sun Java System Web Server (6.1 or 7.0), instead of performing steps 6 and 7, you can generate the load balancer configuration file and send the data over the wire to the Web Server in a single step.

    To do this using the Admin Console, click the desired load balancer and then open the Export tab. In this tab, click Apply Changes Now. This sends the data to the Web Server configuration directory.


  6. Generate the load balancer configuration file.

    To do this using the Admin Console, click the load balancer and then open the Export tab. In this tab, click Export Now.

    This command generates a configuration file to use with the load balancer plug-in shipped with the Sun GlassFish Enterprise Server.

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


    Note –

    To generate the load balancer configuration file automatically and send the data over the wire to the Web Server in a single step, you need to configure Web server for SSL setup and import the DAS certificate. For information on configuring Sun Java System Web Server, see Configuring Sun Web Server.


ProcedureTo Set Up Load Balancing Using the asadmin Tool

  1. Create a load balancer configuration.

    To do this, use the command, asadmin create-http-lb-config.


    Note –

    You can perform all the following steps (Step 2 through Step 7) using a single asadmin command, create-http-lb and its options. For more information about this command, see create-http-lb(1).


  2. Add a reference to a cluster or stand-alone server instance for the load balancer to manage.

    To do this, use the command, asadmin create-http-lb-ref. For more information about this command, see create-http-lb-ref(1).

    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.

    To do this, use the command asadmin enable-http-lb-server. For more information about this command, see enable-http-lb-server(1).

  4. Enable applications for load balancing.

    To do this, use the command asadmin enable-http-lb-application. For more information about this command, see enable-http-lb-application(1).

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

  5. Create a health checker.

    To do this, use the command, asadmin create-http-health-checker. For more information about this command, see create-http-health-checker(1).

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


    Note –

    If you are using Sun Java System Web Server (6.1 or 7.0), instead of performing steps 6 and 7, you can generate the load balancer configuration file and send the data over the wire to the Web Server in a single step.

    To do this using the asadmin tool, set the --autoapplyenabled option of the create-http-lb command to true. For more information about this command, see create-http-lb(1).


  6. Generate the load balancer configuration file.

    To do this, use the command asadmin export-http-lb-config.

    This command generates a configuration file to use with the load balancer plug-in shipped with the Sun GlassFish Enterprise Server.

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


    Note –

    To generate the load balancer configuration file automatically and send the data over the wire to the Web Server in a single step, you need to configure Web server for SSL setup and import the DAS certificate. For information on configuring Sun Java System Web Server, see Configuring Sun Web Server.