Installing and Configuring GlassFish HTTP Load Balancer
GlassFish V2, the latest Java EE 5 Application Server from GlassFishprovides high availability features which include Load Balancing andClustering. GlassFish V2 provides HTTP Load Balancer which is notbundled as part of the it's download. One can however explicitly download this component.Sun Java System WebServer is the supported WebServer for the HTTPLoad Balancer. This blog provides the mannual steps to install andconfigure the GlassFish HTTP Load Balancer and these details relate toSun 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
[*]Download and install the SJSWS 7.0, download
[*]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.
[*]Start the admin server by executing <WS_INSTALL_ROOT>/admin-server/bin/startserv.
[*]Installing and setting up GlassFish Load Balancer
[*]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 operatingsystem platform. For other platforms the values can be - SunOS_X86,Linux and WINNT.
[*]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 deletethe zip files.
[*]Change permissions on all shared libraries of lbplugin as below
chmod -R 755 <GLASSFISH_HOME>/lib/lbplugin/lib
[*]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.
[*]Add execute permission to <WS_INSTALL_ROOT>/plugins/lbplugin/bin/libpassthrough.so.
[*]Copy<GLASSFISH_HOME>/lib/lbplugin/lib/webserver-plugin/<OS>/iws61/errorpages/default-error.htmlto <WS_INSTALL_ROOT>/plugins/lbplugin/errorpages/.
[*]Copy <GLASSFISH_HOME>/lib/lbplugin/lib/webserver-plugin/<OS>/iws61/errorpages/sun-http-lberror.html to
<WS_INSTALL_ROOT>/plugins/lbplugin/errorpages/.
[*]Copy<GLASSFISH_HOME>/lib/lbplugin/lib/webserver-plugin/<OS>/iws61/*.resto <WS_INSTALL_ROOT>/plugins/lbplugin/resource/.Following steps relate to updating the default SJSWS 7.0 instanceconfiguration with Load Balancer specific configuration. While doingso, these changes need to be made to the central repository maintainedby the admin server for the default WebServer instance created uponinstallation. 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 thedefault WebServer instance created.
[*]Copy<GLASSFISH_HOME>/lib/lbplugin/lib/install/templates/loadbalancer.xml.exampleto<WS_INSTALL_ROOT>/admin-server/config-store/<default-config>/config/
[*] This is just an example for notational purpose, the user shouldmanually edit (if choosen to do this way) this file prior to using thisas loadbalancer.xml, to reflect the correct cluster configuration.Refer to Configuring the Load Balancer Pluginfor this.Note manual editing it not the endorsed way to configure theLoad Balancer. GlassFish Admin CLI or GUI are the two supportedapproaches for generating this file, while providing for error freeload balancer configuration generation.
[*]Copy <GLASSFISH_HOME>/lib/lbplugin/lib/dtds/sun-loadbalancer_1_2.dtd to <
<WS_INSTALL_ROOT>/admin-server/config-store/<default-config>/config/
[*]Prepend the under mentioned “##EE” lines to<WS_INSTALL_ROOT>/admin-server/<default-config-name>/config/magnus.confbefore 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
[*]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"
[*]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>
[*]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.
[*]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.
[*]Start the default WebServer instance by executing the start-instance WebServer command from theWebServer wadmCLI 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 fileis not present the Load Balancer would log a message that the filecould not be found. Refer to the Administration support from GlassFishCLI and Admin GUI to create and export this file from DomainAdministration Server to the WebServer.
页:
[1]