1. using tomcat 8 and apache
download Apache HTTP Server and build
cd srclib/apr
./configure --prefix=/usr/local/apr-httpd/
make clean
make
make install
cd ../apr-util
./configure --prefix=/usr/local/apr-util-httpd/ --with-apr=/usr/local/apr-httpd/
make clean
make
make install
cd ../../
./configure --with-apr=/usr/local/apr-httpd/ --with-apr-util=/usr/local/apr-util-httpd/
make clean
make
make install
install to /usr/local/httpd
2. config and start
strat: bin/ .apachectl start
conf: conf/ httpd.conf
config the tomcat cluster as follows:
install different tomcat in different machine
web.xml add
<distributable/>
web.xml revised
<Engine name="Catalina" defaultHost="localhost" jvmRoute="Tomcat1">
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
start the tomcat in different machine
3. conf the httpd server
down load the mod_jk.so and upload to httpd modules dir
bild a file: worker.properties
worker.list=controller,Tomcat1,Tomcat2
#========Tomcat1========
worker.Tomcat1.port=8009
worker.Tomcat1.host=ip1
worker.Tomcat1.type=ajp13
worker.Tomcat1.lbfactor=1
#========Tomcat2========
worker.Tomcat2.port=8009
worker.Tomcat2.host=ip2
worker.Tomcat2.type=ajp13
worker.Tomcat2.lbfactor=1
#========controller========
worker.controller.type=lb
worker.controller.balanced_workers=Tomcat1,Tomcat2
worker.controller.sticky_session=false
build a file mod_jk.conf
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkMount /* controller
modify httpd.conf add
include conf/mod_jk.conf