在负载平衡tomcat时,连接ThreshHold已退出。使用apache和mod_jk

在负载平衡tomcat时,连接ThreshHold已退出。使用apache和mod_jk,apache,tomcat,load-balancing,mod-jk,Apache,Tomcat,Load Balancing,Mod Jk,我继承了一个在两个tomcat实例上运行的java webapp,并通过apache2.2 mod_jk 1.2.19进行负载平衡。这将连接到单独服务器上的数据库。总共4台服务器 DB管理员注意到,在过去几天中,在某些时候,与数据库的应用程序连接突然增加,几分钟后会自动减少。这将导致数据库中的会话数达到最大值 如果您能看看下面的内容,并给出一些建议,我将不胜感激 workers.properties文件如下所示 # Define list of workers that will be used

我继承了一个在两个tomcat实例上运行的java webapp,并通过apache2.2 mod_jk 1.2.19进行负载平衡。这将连接到单独服务器上的数据库。总共4台服务器

DB管理员注意到,在过去几天中,在某些时候,与数据库的应用程序连接突然增加,几分钟后会自动减少。这将导致数据库中的会话数达到最大值

如果您能看看下面的内容,并给出一些建议,我将不胜感激

workers.properties文件如下所示

# Define list of workers that will be used
# for mapping requests
worker.list=loadbalancer,status

# Define tomcatA
# modify the host as your host IP or DNS name.
worker.tomcatA.port=8009
worker.tomcatA.host=10.1.26.21
worker.tomcatA.type=ajp13
worker.tomcatA.lbfactor=1
worker.tomcatA.cachesize=10
worker.tomcatA.socket_keepalive=1
worker.tomcatA.socket_timeout=30
worker.tomcatA.connection_pool_timeout=600
worker.tomcatA.connect_timeout=60000
# Define tomcatB as the failover for tomcatA
worker.tomcatA.redirect=tomcatB

# Define tomcatB
# modify the host as your host IP or DNS name.
worker.tomcatB.port=8009
worker.tomcatB.host=10.1.26.23
worker.tomcatB.type=ajp13
worker.tomcatB.lbfactor=1
worker.tomcatB.cachesize=10
worker.tomcatB.socket_keepalive=1
worker.tomcatB.socket_timeout=30
worker.tomcatB.connection_pool_timeout=600
worker.tomcatB.connect_timeout=60000
# Define tomcatA as the failover for tomcatB
worker.tomcatB.redirect=tomcatA

# Load-balancing behaviour
worker.loadbalancer.type=lb
# Setting the number of retries for a worker
worker.retries=4
worker.loadbalancer.balance_workers=tomcatA,tomcatB
worker.loadbalancer.sticky_session=1
# worker.list=loadbalancer

# Status worker for managing load balancer
worker.status.type=status
下面的错误开始出现在mod_jk日志中

[Wed Nov 16 09:49:27 2016][1380:5076][error]jk_ajp_common.c(947):(tomcatB)无法接收来自tomcat的响应消息,网络问题或tomcat关闭(10.1.26.23:8009),err=-60
[Wed Nov 16 09:49:27 2016][1380:5076][error]jk_ajp_common.c(1536):(tomcatB)Tomcat关闭或拒绝连接。尚未向客户端发送响应(尚未)
[Wed Nov 16 09:49:47 2016][1380:4332][error]jk_ajp_common.c(947):(tomcatA)无法接收来自tomcat的响应消息,网络问题或tomcat关闭(10.1.26.21:8009),err=-60
[Wed Nov 16 09:49:47 2016][1380:4332][error]jk_ajp_common.c(1536):(tomcatA)Tomcat已关机或连接被拒绝。尚未向客户端发送响应(尚未)
[Wed Nov 16 09:49:47 2016][1380:4332][error]jk_ajp_common.c(1879):(tomcatA)连接到tomcat失败。Tomcat可能未启动或侦听的端口错误

金龟子原木

Nov 15, 2016 11:54:14 PM org.apache.jk.common.ChannelSocket processConnection
WARNING: processCallbacks status 2
Nov 15, 2016 11:57:25 PM org.apache.jk.core.MsgContext action
WARNING: Error sending end packet
java.net.SocketException: Software caused connection abort: socket write error
    at java.net.SocketOutputStream.socketWrite0(Native Method)
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
    at org.apache.jk.common.ChannelSocket.send(ChannelSocket.java:518)
    at org.apache.jk.common.JkInputStream.endMessage(JkInputStream.java:112)
    at org.apache.jk.core.MsgContext.action(MsgContext.java:293)
    at org.apache.coyote.Response.action(Response.java:182)
    at org.apache.coyote.Response.finish(Response.java:304)
    at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:204)
    at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
    at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:754)
    at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:684)
    at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:876)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
    at java.lang.Thread.run(Thread.java:722)
从早上6点到下午12点,卡塔琳娜有15000行文字包含了这一段。下面是其他8行。它只出现过一次

джЭ 15, 2016 6:41:11 г org.apache.jk.common.ChannelSocket processConnection
WARNING: processCallbacks status 2
джЭ 15, 2016 6:43:49 г org.apache.catalina.tribes.group.interceptors.TcpFailureDetector memberDisappeared
INFO: Received memberDisappeared[org.apache.catalina.tribes.membership.MemberImpl[tcp://ptahq27escan1.scan.internal:4000,ptahq27escan1.scan.internal,4000, alive=188815394,id={60 83 112 -109 -10 -107 69 87 -112 -21 -49 103 -100 -111 -8 84 }, payload={}, command={}, domain={}, ]] message. Will verify.
джЭ 15, 2016 6:43:50 г org.apache.catalina.tribes.group.interceptors.TcpFailureDetector memberDisappeared
INFO: Verification complete. Member still alive[org.apache.catalina.tribes.membership.MemberImpl[tcp://ptahq27escan1.scan.internal:4000,ptahq27escan1.scan.internal,4000, alive=188815394,id={60 83 112 -109 -10 -107 69 87 -112 -21 -49 103 -100 -111 -8 84 }, payload={}, command={}, domain={}, ]]
джЭ 15, 2016 6:55:26 г org.apache.jk.core.MsgContext action
WARNING: Error sending end packet
在server.xml中,设置了以下ConnectionTimeout

<!-- A "Connector" represents an endpoint by which requests are received
     and responses are returned. Documentation at :
     Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
     Java AJP  Connector: /docs/config/ajp.html
     APR (HTTP/AJP) Connector: /docs/apr.html
     Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="8080" protocol="HTTP/1.1" 
           maxThreads="660" connectionTimeout="20000" 
           redirectPort="8443" URIEncoding="WINDOWS-1256" />

<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" connectionTimeout="20000" URIEncoding="WINDOWS-1256"  />

如果需要任何其他细节,请告诉我
关于

首先,由于您使用的是mod_jk,您可以在server.xml上的8080处注释掉HTTP连接器。您能提供(可能在pastebin中)更多catalina日志吗?尤其是在粘贴片段之前。此外,当问题发生时,您需要在tomcat实例上执行线程转储,并检查并提供输出。运行的线程可能会揭示tomcat正在忙什么并提供答案。首先,由于您使用的是mod_jk,因此可以在server.xml上的8080处注释掉HTTP连接器。您能提供(可能在pastebin中)更多catalina日志吗?尤其是在粘贴片段之前。此外,当问题发生时,您需要在tomcat实例上执行线程转储,并检查并提供输出。运行的线程可能会揭示tomcat正在忙什么,并提供答案。