gpt4 book ai didi

java - 负载平衡 Apache Httpd、Mod_Jk 32 位、Tomcat 7、Windows 2008 R2

转载 作者:行者123 更新时间:2023-11-28 23:34:56 25 4
gpt4 key购买 nike

请在使用 Apache HTTPD 2.4 和 Tomcat 7 配置负载均衡器时需要帮助。我看过很多关于这个主题的帖子,并设法在一定程度上进行了配置。

我面临的奇怪问题是,如果我启动 2 个 tomcat 实例并尝试浏览 APP URL,我会得到“此网页不可用”。如果我停止一个实例,我就可以浏览该应用程序。Apache HTTPD 和 Tomcat 服务器在同一台机器上运行。

workers.properties

worker.list=router,status
worker.worker1.port=8109
worker.worker1.host=172.16.0.79
worker.worker1.type=ajp13
worker.worker1.lbfactor=1
worker.worker1.local_worker=1
worker.worker1.sticky_session=0
worker.worker2.port=8209
worker.worker2.host=172.16.0.79
worker.worker2.type=ajp13
worker.worker2.lbfactor=1
worker.worker2.local_worker=0
worker.worker2.sticky_session=0

worker.router.type=lb
worker.router.balanced_workers=worker1,worker2
worker.router.local_worker_only=1

worker.status.type=status

Httpd.conf

<IfModule mod_proxy.c>
<IfModule mod_proxy_ajp.c>
Include "conf/extra/httpd-ajp.conf"
</IfModule>
</IfModule>

LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogFile logs/jk.log
JkLogLevel debug
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

JkMount /jk_status status
JkMount /APP/* router

服务器.xml

<Connector port="8109" protocol="AJP/1.3" redirectPort="8443" tomcatAuthentication="false"/>
<Connector port="8209" protocol="AJP/1.3" redirectPort="8443" tomcatAuthentication="false"/>

错误日志

[Fri Aug 29 14:49:49.245851 2014] [ssl:warn] [pid 4312:tid 420] AH01909:     www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Aug 29 14:49:49.698251 2014] [ssl:warn] [pid 4312:tid 420] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Aug 29 14:49:49.745051 2014] [mpm_winnt:notice] [pid 4312:tid 420] AH00455: Apache/2.4.9 (Win32) OpenSSL/1.0.1g PHP/5.5.11 mod_jk/1.2.39 configured -- resuming normal operations
[Fri Aug 29 14:49:49.745051 2014] [mpm_winnt:notice] [pid 4312:tid 420] AH00456: Apache Lounge VC11 Server built: Mar 16 2014 12:13:13
[Fri Aug 29 14:49:49.745051 2014] [core:notice] [pid 4312:tid 420] AH00094: Command line: 'C:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Fri Aug 29 14:49:49.745051 2014] [mpm_winnt:notice] [pid 4312:tid 420] AH00418: Parent: Created child process 4156
[Fri Aug 29 14:49:50.571853 2014] [ssl:warn] [pid 4156:tid 296] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Aug 29 14:49:51.008654 2014] [ssl:warn] [pid 4156:tid 296] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Aug 29 14:49:51.055454 2014] [mpm_winnt:notice] [pid 4156:tid 296] AH00354: Child: Starting 150 worker threads.

HTTPD.log

172.17.0.41 - - [29/Aug/2014:14:50:53 -0700] "GET /APP/ HTTP/1.1" 200 1105 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36"
172.17.0.41 - - [29/Aug/2014:14:50:53 -0700] "GET /APP/index.jsp HTTP/1.1" 401 272 "http://172.16.0.79:8080/APP/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36"
172.17.0.41 - - [29/Aug/2014:14:50:53 -0700] "GET /APP/index.jsp HTTP/1.1" 401 272 "http://172.16.0.79:8080/APP/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36"
172.17.0.41 - - [29/Aug/2014:14:50:53 -0700] "GET /APP/index.jsp HTTP/1.1" 401 272 "http://172.16.0.79:8080/APP/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36"

如果配置有问题请指正。提前致谢。

最佳答案

Please send your virtualhost mapping also.

I think that httpd is not deciding to whom ajp connector, it should connect.

For simplicity take 2 different router

worker.list=router,router1,status
worker.worker1.port=8109
worker.worker1.host=172.16.0.79
worker.worker1.type=ajp13
worker.worker1.lbfactor=1
worker.worker1.local_worker=1
worker.worker1.sticky_session=0
worker.worker2.port=8209
worker.worker2.host=172.16.0.79
worker.worker2.type=ajp13
worker.worker2.lbfactor=1
worker.worker2.local_worker=0
worker.worker2.sticky_session=0

worker.router.type=lb
worker.router.balanced_workers=worker1
worker.router.local_worker_only=1
worker.router1.type=lb
worker.router1.balanced_workers=worker2
worker.router1.local_worker_only=1

worker.status.type=status
ex:- jkMount /xyz/* router
jkMount /abc/* router1

you can also make 2 virtualhost mapping for different domain or subdomain

关于java - 负载平衡 Apache Httpd、Mod_Jk 32 位、Tomcat 7、Windows 2008 R2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25567920/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com