Sun GlassFish Enterprise Server v2.1.1 High Availability Administration Guide

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.