作为一个需求,我需要为一个Web应用程序做负载平衡。
我正在处理以下问题。请查看日志
[Tue Jan 06 15:20:06 2015] [10548:14728] [debug] jk_shm_attach::jk_shm.c (337): Attached shared memory memory [1] size=3072 free=0 addr=0x50aa80
[Tue Jan 06 15:20:06 2015] [10548:14728] [debug] jk_child_init::mod_jk.c (3266): Initialized mod_jk/1.2.40
[Tue Jan 06 15:20:55 2015] [10548:11696] [debug] jk_translate::mod_jk.c (3623): missing uri map for localhost:/eimsgoed
[Tue Jan 06 15:20:55 2015] [10548:11696] [debug] jk_map_to_storage::mod_jk.c (3791): missing uri map for localhost:/eimsgoed
[Tue Jan 06 15:21:56 2015] [10548:11696] [debug] jk_translate::mod_jk.c (3623): missing uri map for localhost:/eimsgoed
[Tue Jan 06 15:21:56 2015] [10548:11696] [debug] jk_map_to_storage::mod_jk.c (3791): missing uri map for localhost:/eimsgoed
/eimsgoed是我在tomcat示例中部署的应用程序。
请查看我的workers.properties文件
worker.list=balancer
worker.tomcat1.type=ajp13
worker.tomcat1.port=9004
worker.tomcat1.host=localhost
worker.tomcat2.type=ajp13
worker.tomcat2.port=9024
worker.tomcat2.host=localhost
worker.tomcat3.type=ajp13
worker.tomcat3.port=9012
worker.tomcat3.host=localhost
worker.balancer.type=lb
worker.balancer.balance_workers=tomcat1,tomcat2,tomcat3
worker.list=jkstatus
worker.jkstatus.type=status
我的httpd.conf文件
LoadModule jk_module modules/mod_jk.so
# Path to workers.properties
JkWorkersFile conf/workers.properties
# Path to jk logs
JkLogFile logs/mod_jk.log
# Jk log level [debug/error/info]
JkLogLevel debug
# Jk log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions for forwarding
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
JkMount /eimsgoed balancer
JkMount /status jkstatus
所有3个tomcat示例的server.xml
tomcat 1示例
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="9004" protocol="AJP/1.3" redirectPort="9003" />
<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat1">
tomcat 2示例
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="9024" protocol="AJP/1.3" redirectPort="9023" />
<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat2">
tomcat 3示例
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="9012" protocol="AJP/1.3" redirectPort="9011" />
<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat3">
在URI中,我哪里出错了?
[Tue Jan 06 15:21:56 2015] [10548:11696] [debug] jk_map_to_storage::mod_jk.c (3791): missing uri map for localhost:/eimsgoed
有关信息,我使用的是Tomcat 7、Apache HTTP服务器2.4.10和Tomcat Mod_JK连接器1.2.40、Windows 7操作系统
请在这个问题上指点我。
3条答案
按热度按时间nwo49xxi1#
我在配置中没有看到任何错误。可能是Apache 2.4和JK的问题。
还有另一种配置负载平衡器的方法,即使用mod_proxy:
https://serverfault.com/questions/604615/apache-mod-proxy-balancer-tomcat-load-balancing-should-not-redirect-until-we
还有这里:
http://chandank.com/application-server/tomcat/tomcat-load-balancer-using-mod-proxy-and-session-sticky
jjhzyzn02#
我遇到了同样的问题,而且我的配置几乎与您相同。
我在
httpd.conf
文件中添加了VirtualHost
Map,它就开始工作了。von4xj4u3#
这与在VirtualHost中指定JKMount时给出的答案基本相同,但您可以只指定JKMountCopy= On,而不是复制相同的配置。
问题是,虚拟主机不会继承此配置,您必须指定此指令来继承它。