apache+tomcat负载均衡出错
手中有一个项目需要用的负载均衡,一般我们会选择apache或者nginx,以前一直用apache做转发,对apache相对熟悉,所以选择了apache。
tomcat1:http://192.168.100.133:8093/BaseCoreWebComponent/test.jsp (正常)
tomcat2:http://192.168.166.243:28094/BaseCoreWebComponent/test.jsp(正常)
apache : http://127.0.0.1/BaseCoreWebComponent/test.jsp (无法访问)
于是查看mod_jk.log和重新走查配置过程,发现两个问题:
(1)参考的文章,有个配置写错
- worker.controller.type=lb
- worker.controller.balanced_workers=tomcat1,tomcat2,tomcat3
- worker.controller.sticky_session=false
- worker.controller.sticky_session_force=1
- #worker.controller.sticky_session=1
正确的应该是
worker.controller.type=lb worker.controller.balance_workers=tomcat_8093,tomcat_base_js worker.controller.sticky_session=false #worker.controller.sticky_session_force=1 #worker.controller.sticky_session=1
(2)使用了错误的端口
#========tomcat1======== worker.tomcat_8093.port=8693 worker.tomcat_8093.host=192.168.100.133 worker.tomcat_8093.type=ajp13 worker.tomcat_8093.lbfactor = 1 #========tomcat2======== worker.tomcat_base_js.port=48024 worker.tomcat_base_js.host=192.168.166.243 worker.tomcat_base_js.type=ajp13 worker.tomcat_base_js.lbfactor = 1
上面标红色的端口需使用
<!-- Define an AJP 1.3 Connector on port 8693 --> <Connector port="8693" protocol="AJP/1.3" redirectPort="8493" />
而非下面的端口
<Connector port="8093" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8493" />
相关推荐
Kafka 2020-09-18
Wepe0 2020-10-30
杜倩 2020-10-29
windle 2020-10-29
minerd 2020-10-28
mengzuchao 2020-10-22
Junzizhiai 2020-10-10
bxqybxqy 2020-09-30
风之沙城 2020-09-24
kingszelda 2020-09-22
大唐帝国前营 2020-08-18
yixu0 2020-08-17
TangCuYu 2020-08-15
xiaoboliu00 2020-08-15
songshijiazuaa 2020-08-15
xclxcl 2020-08-03
zmzmmf 2020-08-03
newfarhui 2020-08-03
likesyour 2020-08-01