In Windows XP, apache2.2.11 integrates tomcat6.0.20 (cluster mode & No cluster mode)

Source: Internet
Author: User
I. Use mod_jk.so

1. No cluster mode
1) download and install apache2.2.11 and atat6.0.20

2) download the mod_jk-1.2.28-httpd-2.2.3.so renamed mod_jk.so put in % apache_home % \ modules (do not change the name will be wrong, do not know why)

3) Open % apache_home % \ conf \ httpd. conf, find the last include node, add the mod-jk_nocluster.conf

4) In % apache_home % \ conf \ new mod-jk_nocluster.conf, add the following content:

Loadmodule jk_module modules/mod_jk.so jkworkersfile CONF/workers_nocluster.properties jklogfile logs/mod_jk_nocluster.log jkloglevel info jklogstampformat "[% A % B % d % H: % m: % S % Y] "jkoptions + forwardkeysize + forwarduricompat-forwarddirectories jkrequestlogformat" % w % v % t "jkmount/* ajp13 # Turn off host lookup. If it is on, performance is greatly affected, there can be a latency of more than 10 seconds.
Hostnamelookups off 5) in % apache_home % \ conf \ create workers_nocluster.properties, add the following content:

Worker. List = ajp13
Worker. Maintain = 60 Worker. ajp13.port = 8009
Worker. ajp13.host = localhost
Worker. ajp13.type = ajp13
Worker. ajp13.lbfactor = 1

6) start Apache and tomcat. Enter http: // localhost in the address bar to see that the Tomcat screen is successful.

2. Use a cluster (take two Tomcat servers as an example)

1), 2) Same as above

3) Open % apache_home % \ conf \ httpd. conf, find the last include node, change mod-jk_nocluster.conf to mod-jk_cluster.conf 4) in % apache_home % \ conf \ new mod-jk_cluster.conf, add the following:


Loadmodule jk_module modules/mod_jk.so jkworkersfile CONF/workers_cluster.properties jklogfile logs/mod_jk_cluster.log jkloglevel info jklogstampformat "[% A % B % d % H: % m: % S % Y] "jkoptions + forwardkeysize + forwarduricompat-forwarddirectories jkrequestlogformat" % w % v % t "jkmount/* controller hostnamelookups off

5) Create workers_cluster.properties in % apache_home % \ conf \ and add the following content:

Worker. List = controller, worker at1, tomcat2 # Server LIST
#========= Export AT1 ========
Worker. tomcat1.port = 18109 # ajp13 port number, which is configured in server. xml under tomcat. The default value is 8009.
Worker. tomcat1.host = localhost # Tomcat host address. If not, enter the IP address
Worker. tomcat1.type = ajp13
Worker. tomcat1.lbfactor = 1 # server weighting ratio. The higher the value, the more requests are allocated.
# Worker. tomcat1.redirect = tomcat2 # in the Cluster Environment, JK directs the request to the specified worker for processing when the worker AT1 fails or does not respond.
#======= Tomcat2 =========
Worker. tomcat2.port = 18209 # ajp13 port number, which is configured in server. xml under tomcat. The default value is 8009.
Worker. tomcat2.host = localhost # Tomcat host address. If not, enter the IP address
Worker. tomcat2.type = ajp13
Worker. tomcat2.lbfactor = 1 # server weighting ratio. The higher the value, the more requests are allocated.
# Worker. tomcat2.activation = disabled ##======= controller, Server Load balancer controller ======
Worker. Controller. type = LB
Worker. Controller. balanced_workers = worker at1, tomcat2 # specify Tomcat that shares the request
Worker. Controller. sticky_session = 1

6) modify the tomcat1 configuration file server. xml. The configuration modification of tomcat2 is the same as that of tomcat1. You only need to pay attention to the relevant port number, which cannot be repeated on the same server.

The following lists the nodes to be modified:

# The default value is 8005.
<Server port = "8105" shutdown = "shutdown">

# The default value is 8080. You can modify the thread concurrency as needed.
<Connector Port = "8180"...>

#8009 by default,
<Connector Port = "8109" protocol = "AJP/1.3" redirectport = "8443"/>

# Standalone for name
<Engine name = "Catalina" defaulthost = "localhost" jvmroute = "tomcat1">

<Cluster classname = "org. Apache. Catalina. Ha. tcp. simpletcpcluster"
Channelsendoptions = "6">
<Manager
Classname = "org. Apache. Catalina. Ha. session. backupmanager"
Expiresessionsonshutdown = "false" notifylistenersonreplication = "true"
Mapsendoptions = "6"/>
<! --
<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"
Mcastbindaddress = "127.0.0.1" # If VPN and SVN are installed, binding failure may occur.
Address = "228.0.0.4" Port = "45564"
Frequency = "500" droptime = "3000"/>
<Cycler
Classname = "org. Apache. Catalina. tribes. Transport. NiO. nioreceiver"
Address = "Auto" Port = "4001" 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"/>
<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; "/> <clusterlistener
Classname = "org. Apache. Catalina. Ha. session. clustersessionlistener"/>
</Cluster>

Add
<Deployer classname = "org. Apache. Catalina. Ha. Deploy. farmwardeployer"
Tempdir = "/tmp/war-temp /"
Deploydir = "/tmp/war-deploy /"
Watchdir = "/tmp/war-Listen /"
Watchenabled = "false"/>

7) pack the web application into a war package and place it under every webapps. Make sure that the Web. xml file is added.
<Display-Name> xxx/display-Name>
<Distributable/>
Or directly put it in Tomcat's web. xml.

So far the mod-jk.so mode with good, start the service is OK!
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.