我在一个redhat linux web服务器上配了apache2.2+2个tomcat6,使用了tomcat-connectors-1.2.23。 问题是:相同的配置在局域网内和服务器本地测试负载均衡成功,但在internet上测试却一个tomcat的cpu负载很高,而另外一个很少有cpu负载。用浏览器访问页面,第一次打开失败,第二次成功。并且使用session报什么route的异常。不知道什么原因!
我的httpd.conf相关配置:
# Load mod_jk
LoadModule jk_module modules/mod_jk.so
# Configure mod_jk
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkShmFile logs/mod_jk.log
JkLogLevel error
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkMount /*.html loadbalancer
JkMount /*.jsp loadbalancer
JkMount /*.do loadbalancer
我的workers.properties相关配置:
worker.list=loadbalancer
worker.maintain=60
worker.tomcat.port=8009
worker.tomcat.host=localhost
worker.tomcat.type=ajp13
worker.tomcat.lbfactor=5
worker.tomcat2.port=8010
worker.tomcat2.host=localhost
worker.tomcat2.type=ajp13
worker.tomcat2.lbfactor=5
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=tomcat, tomcat2
tomcat的server.xml相关配置:
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="Standalone" defaultHost="localhost" jvmRoute="tomcat"/>
tomcat2的server.xml相关配置:
<Connector port="8010" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="Standalone" defaultHost="localhost" jvmRoute="tomcat2"/>