Thứ Ba, 8 tháng 3, 2011

Cluster Tomcat

Môi trường:
- Tomcat 6.0.18
- Java : java version "1.6.0_11"
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode)
- Apache HTTPD 2.2.17, mod_jk 1.2.27

Trong file httpd.conf khai báo:


LoadModule jk_module modules/mod_jk-1.2.27-httpd-2.2.10.so
JkWorkersFile "C:\Program Files\Apache Software Foundation\Apache2.2\conf\workers.properties"
JkLogFile "logs/mod_jk.log"
JkLogLevel error
JkMount /cluster loadbalancer
JkMount /cluster/* loadbalancer

File workers.properties

worker.list=tomcatA,tomcatB,tomcatC,loadbalancer

worker.tomcatA.port=8109
worker.tomcatA.host=localhost
worker.tomcatA.type=ajp13
worker.tomcatA.lbfactor=1

worker.tomcatB.port=8209
worker.tomcatB.host=localhost
worker.tomcatB.type=ajp13
worker.tomcatB.lbfactor=1

worker.tomcatC.port=8309
worker.tomcatC.host=localhost
worker.tomcatC.type=ajp13
worker.tomcatC.lbfactor=1

worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=tomcatA,tomcatB,tomcatC
worker.loadbalancer.sticky_session=1

file server.xml của TomcatA:






type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />




connectionTimeout="20000"
redirectPort="8443" />







resourceName="UserDatabase"/>

unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">





Các file TomcatB và TomcatC cũng sửa tương tự file TomcatA.

Không có nhận xét nào: