Installing and Configuring GlassFish HTTP Load Balancer

GlassFish V2, the latest Java EE 5 Application Server from GlassFish provides high availability features which include Load Balancing and Clustering. GlassFish V2 provides HTTP Load Balancer which is not bundled as part of the it's download. One can however explicitly download this component.

Sun Java System WebServer is the supported WebServer for the HTTP Load Balancer. This blog provides the mannual steps to install and configure the GlassFish HTTP Load Balancer and these details relate to Sun Java System WebServer 7.0 - the latest WebServer offering from Sun.

Installing Load Balancer on SJSWS 7.0 under default installation setup of SJSWS 7.0


  • Installing SJSWS 7.0


  1. Download and install the SJSWS 7.0, download
  2. Create the following directories:
    <WS_INSTALL_ROOT>/plugins/lbplugin/bin
    <WS_INSTALL_ROOT>/plugins/lbplugin/resource
    <WS_INSTALL_ROOT>/plugins/lbplugin/errorpages
    where,
    <WS_INSTALL_ROOT> is SJSWS 7.0 installation directory.
  3. Start the admin server by executing <WS_INSTALL_ROOT>/admin-server/bin/startserv.


  • Installing and setting up GlassFish Load Balancer


  1. Download aslb (GlassFish Load Balancer component) from the link:
    http://download.java.net/javaee5/external/SunOS/aslb/jars/aslb-9.1-MS4-b1.jar
    where, SunOS literal relates to the Solaris Sparc based operating system platform. For other platforms the values can be - SunOS_X86, Linux and WINNT.
  2. Unjar to install into GlassFish installation, where <GLASSFISH_HOME> identifies the GlassFish installation directory.

    • Create <GLASSFISH_HOME>/lib/lbplugin.

    • Unjar aslb-9.1-MS4-b1.jar file in <GLASSFISH_HOME>/lib/lbplugin.

    • There are 2 zip files bundled inside the aslb jar: SUNWaslb.zip, SUNWaspx.zip, unzip these 2 zip files in the same directory and delete the zip files.

    • Change permissions on all shared libraries of lbplugin as below
      chmod -R 755 <GLASSFISH_HOME>/lib/lbplugin/lib


  3. Copy <GLASSFISH_HOME>/lib/lbplugin/lib/webserver-plugin/<OS>/iws61/libpassthrough.so to
    <WS_INSTALL_ROOT>/plugins/lbplugin/bin/.
    Where <OS> refers to solaris' for the Solaris platform.,'linux' for the Linux platform and 'windows' for the Windows platform.
  4. Add execute permission to <WS_INSTALL_ROOT>/plugins/lbplugin/bin/libpassthrough.so.
  5. Copy <GLASSFISH_HOME>/lib/lbplugin/lib/webserver-plugin/<OS>/iws61/errorpages/default-error.html to <WS_INSTALL_ROOT>/plugins/lbplugin/errorpages/.
  6. Copy <GLASSFISH_HOME>/lib/lbplugin/lib/webserver-plugin/<OS>/iws61/errorpages/sun-http-lberror.html to
    <WS_INSTALL_ROOT>/plugins/lbplugin/errorpages/.
  7. Copy <GLASSFISH_HOME>/lib/lbplugin/lib/webserver-plugin/<OS>/iws61/\*.res to <WS_INSTALL_ROOT>/plugins/lbplugin/resource/.
  8. Following steps relate to updating the default SJSWS 7.0 instance configuration with Load Balancer specific configuration. While doing so, these changes need to be made to the central repository maintained by the admin server for the default WebServer instance created upon installation. This repository is identified by <WS_INSTALL_ROOT>/admin-server/config-store/<default-config-name>/config/. Where, <default-config-name> is the config name created for the default WebServer instance created.

  9. Copy <GLASSFISH_HOME>/lib/lbplugin/lib/install/templates/loadbalancer.xml.example to <WS_INSTALL_ROOT>/admin-server/config-store/<default-config>/config/


    • This is just an example for notational purpose, the user should manually edit (if choosen to do this way) this file prior to using this as loadbalancer.xml, to reflect the correct cluster configuration. Refer to Configuring the Load Balancer Plugin for this.Note manual editing it not the endorsed way to configure the Load Balancer. GlassFish Admin CLI or GUI are the two supported approaches for generating this file, while providing for error free load balancer configuration generation.


  10. Copy <GLASSFISH_HOME>/lib/lbplugin/lib/dtds/sun-loadbalancer_1_2.dtd to <
    <WS_INSTALL_ROOT>/admin-server/config-store/<default-config>/config/
  11. Prepend the under mentioned “##EE” lines to <WS_INSTALL_ROOT>/admin-server/<default-config-name>/config/magnus.conf before the following “Init” directive -

    Init fn="load-modules" shlib="libj2eeplugin.so" shlib_flags="(global|now)"

    ##BEGIN EE LB Plugin Parameters
    Init fn="load-modules" shlib="${WS_INSTALL_ROOT}/plugins/lbplugin/bin/libpassthrough.so"
    funcs="init-passthrough,service-passthrough,name-trans-passthrough" Thread="no"
    Init fn="init-passthrough"
    ##END EE LB Plugin Parameters

  12. Insert the under mentioned line before the first occurrence of the "NameTrans" directive in <WS_INSTALL_ROOT>/admin-server/<default-config-name>/config/obj.conf

    NameTrans fn="name-trans-passthrough" name="lbplugin" config-file="loadbalancer.xml"

  13. Append the following lines to <WS_INSTALL_ROOT>/admin-server/<default-config-name>/config/obj.conf

    <Object name="lbplugin">
    ObjectType fn="force-type" type="magnus-internal/lbplugin"
    PathCheck fn="deny-existence" path="\*/WEB-INF/\*"
    Service type="magnus-internal/lbplugin" fn="service-passthrough"
    Error reason="Bad Gateway" fn="send-error" uri="$docroot/badgateway.html"
    </Object>

  14. Deploy the configuration to the default WebServer instance created by executing the deploy-config WebServer command from WebServer's wadm CLI utility.

    <WS_INSTALL_ROOT>/bin/wadm deploy-config –user=<admin> <default-config-name>
    where, <admin> is the admin user name.

  15. Update the default WebServer instance startserv script by suffixing the following to LD_LIBRARY_PATH,
    <GLASSFISH_HOME>/lib/lbplugin/lib. You can also get this done by setting the environment variable $LD_LIBRARY_PATH to this value
  16. .

  17. Start the default WebServer instance by executing the start-instance WebServer command from the WebServer wadm CLI utility

    <WS_INSTALL_ROOT>/bin/wadm start-instance --user=<admin> --config=<default-config-name>



    • NOTE:
      Step 11, takes into account existence of loadbalancer.xml, if this file is not present the Load Balancer would log a message that the file could not be found. Refer to the Administration support from GlassFish CLI and Admin GUI to create and export this file from Domain Administration Server to the WebServer.

Comments:

Post a Comment:
Comments are closed for this entry.
About

pankajjairath

Search

Top Tags
Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today