Apache and Tomcat clusters under Liunx

  
 

Required component package

jdk-1_5_0-linux-i586-rpm.bin ----Jkd

apache-tomcat-5.5.27.tar.gz ---Tomcat

httpd-2.0.63.tar.gz ---Apache

jakarta-tomcat-connectors-jk-1.2.1-src.tar.gz ---Apache and Tomcat Connector


Installation

1, install Tomcat, Apache, mod_jk Previous article has been explained

File configuration


Configuration 1, modify the Apache2/conf/httpd.conf file

Add

LoadModule at the end jk_module modules/mod_jk.soJkWorkersFile "conf/workers.properties"JkLogFile "logs/Mod_jk.log"JkLogLevel Info

JkMount /*. workers


2. Create new workers.properties file in apache2/conf/directory as follows

worker.list=workers,tomcat1,tomcat2

#========tomcat1========

worker.tomcat1.type=ajp13worker.tomcat1. Port=8009 #ajp13 Port number, server.xml configuration under tomcat, default 8009worker.tomcat1.host=localhost #tomcat host address, if not for the machine, please fill in the ip address worker.tomcat1.lbfactor=1worker.tomcat1. Fail_on_s Tatus=-500,-503,404

#========tomcat2========worker.tomcat2.type=ajp13worker.tomcat2.port=8010worker.tomcat2.host=localhost Worker.tomcat2.lbfactor=1worker.tomcat2.fail_on_status=500,503,-404

#========controller, load balancing controller ========worker.workers.type =lbworker.retries=5worker.workers.balance_workers=tomcat1,tomcat2worker.workers.sticky_session=trueworker.workers.sticky_session_force=false



3, resolve conflicts, if To deploy multiple Tomcats on the same computer
, modify the Tomcat port, < xmlnamespace prefix ="o" ns ="urn:schemas-microsoft-com:office:office" />< Br>

Find the following places in the tomcat/conf/server.xml file

<Server port="8005" shutdown="SHUTDOWN">

<Connector port ="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

<Connector port="8009" protocol="AJP/1.3" redirectPort="84 43" />

Edit to

8005 -------> 8015

8080 ------> 8081

8009------.>8019

Note: <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

should be consistent with the worker.tomcat2.port=8019 configuration in the workers.properties file


4 Configuring Session Replication

1> respectively

<Engine name="Catalina" defaultHost="localhost">

Change to

<Engine in each Tomcat/conf/server.xl Name="Catalina" defaultHost="localhost" jvmRoute="tomcat1">

<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat2">< Br>

2" in each Tomcat/conf/server.xml

<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat1">

Add

<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"

chan nelSendOptions="6">


<!--

<Manager className="org.apache.catalina.ha.session.BackupManager"

expireSessionsOnShutdown="false"

notifyListenersOnReplication="true"

mapSendOptions="6"/>

-->< Br>

<Manager className="org.apache.catalina.ha.session.DeltaManager"

expireSessionsOnShutdown="false"

notifyListenersOnReplication="true"/> ;


<Channel className="org.apache.catalina.tribes.group.GroupChannel">

<Membership className="org.apache .catalina.tribes.membership.McastService"

address="228.0.0.4"

port="45564"

frequency="500"

dropTime="3000"/>

<Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"

address=" Auto"

port="5002"

selectorTimeout="100"

maxThreads="6"/>


<Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">

<Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>

</Sender>

<Interceptor className= "org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>

<Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>< Br>

<Interceptor className="org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor"/>

</Channel>


<Valve className="org.apache.catalina.ha.tcp.ReplicationValve"

filter=".*\\.gif;.*\\.js;.*\\.jpg;. *\\.png;.*\\.htm;.*\\.html;.*\\.css;.*\\.txt;"/>


<Deployer className ="org.apache.catalina.ha.deploy.FarmWarDeployer"

Copyright © Windows knowledge All Rights Reserved