Tomcat Load Balancing and Fault Tolerance Configuration

Tomcat Load Balancing and Fault Tolerance Configuration This document details steps for setting up TIBCO PortalBuilder on the Apache Tomcat servlet en...
Author: Nigel Chambers
10 downloads 0 Views 176KB Size
Tomcat Load Balancing and Fault Tolerance Configuration This document details steps for setting up TIBCO PortalBuilder on the Apache Tomcat servlet engine to use load balancing and fault tolerance. Apache JK connector is used to configure Tomcat with the Apache HTTP Server.

http://www.tibco.com Global Headquarters 3303 Hillview Avenue Palo Alto, CA 94304 Tel: +1 650-846-1000 Toll Free: 1 800-420-8450 Fax: +1 650-846-1005 © 2007, TIBCO Software Inc. All rights reserved. TIBCO, the TIBCO logo, The Power of Now, and TIBCO Software are trademarks or registered trademarks of TIBCO Software Inc. in the United States and/or other countries. All other product and company names and marks mentioned in this document are the property of their respective owners and are mentioned for identification purposes only.

Document

Table of Contents Tomcat Load Balancing and Fault Tolerance................................................... 3 Steps to follow .................................................................................................... 3 Machine1 ..........................................................................................................................3 Machine2 ..........................................................................................................................5 Machine3 ..........................................................................................................................5 Service distribution ...........................................................................................................6

Tomcat Load Balancing and Fault Tolerance

2

Document

Tomcat Load Balancing and Fault Tolerance

Steps to follow Machine1 1. Install the Apache HTTP Server. 2. Install Apache Tomcat instances T1 and T2. The connector port, shutdown port, and AJP connector port in the server.xml file of the second instance of Tomcat (T2) must be changed, because the first instance is already using the default ports. 3. Start both Tomcat instances, T1 and T2, and the Apache HTTP Server. 4. Move mod_jk-apache-2.2.3.so to \modules. Note: mod_jk can be downloaded from the following location: http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.20/ 5. Rename it to mod_jk.so. 6. Configure mod_jk. mod_jk uses a file named workers.properties, which is used to define where the Apache HTTP Server looks for the Tomcat servlet engine instances. Sample workers.properties file: # Defining a worker named ajp13w and of type ajp13 # Note that the name and the type do not have to match. worker.ajp13w1.type=ajp13 worker.ajp13w1.host=[hostname for T1] worker.ajp13w1.port=[port for T1] worker.ajp13w2.type=ajp13 worker.ajp13w2.host=[hostname for T2] worker.ajp13w2.port=[port for T2] # The workers that jk should create and work with worker.list=wlb1

Tomcat Load Balancing and Fault Tolerance

3

Document

# Defining a load balancer worker.wlb1.type=lb worker.wlb1.balance_workers=ajp13w1,ajp13w2 worker.wlb1.sticky_session=True 7. Configuring Apache with mod_jk. Modify the httpd.conf file to tell the Apache HTTP Server where to find the workers.properties file, where to log mod_jk requests, and the format of the log files. Open the file \conf\httpd.conf and add the following lines at the bottom: LoadModule jk_module modules/mod_jk.so # Where to find workers.properties JkWorkersFile conf/workers.properties # Where to put jk JkLogFile logs/mod_jk.log # Select the log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " # JkOptions indicate to send SSL KEY SIZE, JkOptions +ForwardKeySize +ForwardURICompat ForwardDirectories # JkRequestLogFormat set the request format JkRequestLogFormat "%w %V %T" # Send servlet for context / jsp-examples to worker named wrkr JkMount /jsp-examples wlb1 JkMount /*/* wlb1 JkMount /* wlb1 # Send JSPs for context /jsp-examples/* to worker named wrkr JkMount /jsp-examples/* wlb1 JkMount /*.jsp wlb1 8. Test the Apache–Tomcat configuration setup. a. Shutdown both the Apache HTTP Server and Tomcat. b. Start Tomcat. c. Start the Apache server. d. Point your browser to http://localhost: and verify that you get the default Tomcat page. e. Point your browser to http://localhost/jsp-examples/ and verify that you get the index page for the Tomcat examples. This will be served by the Apache HTTP Server, and will indicate that you have completed your integration of Apache and Tomcat successfully. Check the configuration setup for both Tomcat instances, T1 and T2. 9. Install TRA, Admin, and PortalBuilder, and deploy the portal. Notes: a. Register both Tomcat instances T1 and T2 under the same TIBCO Administrator domain. While registering Tomcat T1 and T2, give the Apache HTTP Server port as the web server port and the actual T1 and T2 ports as the servlet engine ports.

Tomcat Load Balancing and Fault Tolerance

4

Document

b. At the Select Servlet Engine Vendor dialog during Portal Configuration, two registered servlet engines, T1 and T2, will appear. Select T1 and not T2. 10. Add the jvmRoute attribute to the Engine element in T1 and T2’s server.xml file. Note: The name of the worker and the jvmRoute must be equal.

Machine2 1. Install the Apache HTTP Server using port 81. 2. Install Tomcat instances T3 and T4. Use different connector, shutdown, and AJP ports. 3. Configure Tomcat instances T3 and T4 with Apache HTTP Server using Apache JK Connector (just as with machine1). 4. Install TRA and add machine2 to machine1’s TIBCO Administrator domain. Note: The domain utility must be invoked from machine2, that is, from the machine that is being added to machine1’s TIBCO Administrator domain. 5. Register Tomcat Servlet Engines T3 and T4 with the TIBCO Administrator domain. Note: While registering Tomcat instances T3 and T4 with the TIBCO Administrator domain, give the Apache HTTP Server port (81) as the web server port and the actual T3 and T4 ports as the servlet engine ports. 6. Install Portal Builder. You must select the same TIBCO Administrator domain as that used for all other PortalBuilder instances. In the Application Domain Selection dialog, the installer shows only the application domain selected for the first instance of PortalBuilder. 7. Add the jvmRoute attribute to the Engine element in T3 and T4’s server.xml file. Note: The name of the worker and the jvmRoute must be equal.

Machine3 1. Install Apache HTTP Server using port 82. 2. Install Tomcat instances T5 and T6. Use different connector, shutdown, and AJP ports. 3. Configure Tomcat instances T5 and T6 with Apache HTTP Server using Apache JK Connector. Make the Apache-82 JK connector fault tolerant by editing workers.properties as follows: worker.ajp13w5.lbfactor=100 worker.ajp13w6.lbfactor=0 …where ajp13w5 denotes T5 and ajp3w6 denotes T6. 4. Install TRA and add machine3 to machine1’s TIBCO Administrator domain. Note: The domain utility must be invoked from machine3, that is, from the machine that is being added to machine1’s TIBCO Administrator domain. 5. Register Tomcat Servlet Engines T5 and T6 with TIBCO Administrator domain. Note: While registering Tomcat T5 and T6 with TIBCO Administrator Domain give the Apache HTTP Server port (82) as the web server port and the actual T5 and T6 ports as the servlet engine ports. 6. Add the jvmRoute attribute to the Engine element in T5 and T6’s server.xml file. Tomcat Load Balancing and Fault Tolerance

5

Document

Note: The name of the worker and the jvmRoute must be equal. 7. Install Portal Builder. You must select the same TIBCO Administrator domain as that used for all other PortalBuilder instances. In the Application Domain Selection dialog, the installer shows only the application domain selected for the first instance of PortalBuilder.

Service distribution For best performance, the most heavily used PortalBuilder services should be deployed in clusters apart from other services, on the most powerful server machines. The example given in this document shows the PAS-SPK service—and the shared template applications (STA_PB) associated with the PAS-SPK service—being distributed to Tomcat servlet engines T3 and T4 on the second-tier cluster (Machine2). The other 8 PortalBuilder services are deployed on the first tier (Machine1) to Tomcat servlet engines T1 and T2. The third-tier machine (Machine3) is used as a fault tolerant cluster containing the CPS and BPS_PB services, which cannot be deployed to a clustered server. 1. Distribute the PAS-SPK and STA_PB services from T1 to T3 using TIBCO Administrator. 2. Distribute the CPS, BPS_PB and STA_PB services from T1 to T5 using TIBCO Administrator. 3. Manually distribute all T1 services to T2. Copy the contents of \\\shared\lib \\\shared\classes \\\conf\Catalina\localhost \\\server\webapps from the T1 directory to the T2 directory. 4. Manually distribute the PAS-SPK and STA_PB services from T3 to T4. Copy the contents of \\\shared\lib \\\shared\classes \\\conf\Catalina\localhost \\\server\webapps from the T3 directory to the T4 directory. 4. Manually distribute the BPS_PB and STA_PB services from T5 to T6. Copy the contents of \\\shared\lib \\\shared\classes \\\conf\Catalina\localhost \\\server\webapps from the T5 directory to the T6 directory.

Tomcat Load Balancing and Fault Tolerance

6

Suggest Documents