运行一段时间后,Apache / mod_jk模块无法连接jboss

时间:2012-10-25 04:02:13

标签: java apache tomcat jboss

我使用Apache/mod_jk module连接jboss。但是经过一段时间后,出了点问题。

Apache:2.2.22 mod_jk:1.2.37 Jboss:5.1.0 GA(集群环境) 操作系统:CentOS 5.2 x86_64 JDK:1.6.0_30-b12

以下是mod_jk.log的一部分

[Thu Oct 18 15:21:35.044 2012] [26272:47208100643936] [error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (node1) cping/cpong after connecting to the backend server failed (errno=110)
[Thu Oct 18 15:21:35.044 2012] [26272:47208100643936] [error] ajp_send_request::jk_ajp_common.c (1630): (node1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=110)
[Thu Oct 18 15:22:35.643 2012] [26272:47208100643936] [error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (node1) cping/cpong after connecting to the backend server failed (errno=110)
[Thu Oct 18 15:22:35.643 2012] [26272:47208100643936] [error] ajp_send_request::jk_ajp_common.c (1630): (node1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=110)
[Thu Oct 18 15:22:35.643 2012] [26272:47208100643936] [error] ajp_service::jk_ajp_common.c (2626): (node1) connecting to tomcat failed.
[Thu Oct 18 15:23:36.143 2012] [26272:47208100643936] [error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (node2) cping/cpong after connecting to the backend server failed (errno=110)
[Thu Oct 18 15:23:36.143 2012] [26272:47208100643936] [error] ajp_send_request::jk_ajp_common.c (1630): (node2) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=110)
[Thu Oct 18 15:24:36.742 2012] [26272:47208100643936] [error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (node2) cping/cpong after connecting to the backend server failed (errno=110)
[Thu Oct 18 15:24:36.742 2012] [26272:47208100643936] [error] ajp_send_request::jk_ajp_common.c (1630): (node2) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=110)
[Thu Oct 18 15:24:36.742 2012] [26272:47208100643936] [error] ajp_service::jk_ajp_common.c (2626): (node2) connecting to tomcat failed.
[Thu Oct 18 15:24:36.742 2012] [26272:47208100643936] [error] service::jk_lb_worker.c (1485): All tomcat instances failed, no more workers left

http.conf的一部分:

JkWorkersFile conf/workers.properties
JkMountFile conf/uriworkermap.properties
JkLogFile logs/mod_jk.log
JkLogLevel warn

workers.properties:

 worker.list=loadbalancer,loadbalancer_2,status
 worker.node1.port=8009
 worker.node1.host=10.123.76.6
 worker.node1.type=ajp13
 worker.node1.lbfactor=1

 worker.node2.port=8009
 worker.node2.host=10.123.76.4
 worker.node2.type=ajp13
 worker.node2.lbfactor=1

 worker.loadbalancer.type=lb
 worker.loadbalancer.balance_workers=node1,node2

 worker.loadbalancer.sticky_session=true
 worker.loadbalancer.sticky_session_force=false

 worker.loadbalancer_2.type=lb
 worker.loadbalancer_2.balance_workers=node1,node2
 worker.loadbalancer_2.sticky_session=true
 worker.loadbalancer_2.sticky_session_force=false

注意事项:Jboss工作正常。 telnet jboss 8009是正常的。如果你重新启动jboss,它会再次运行。但是,如果你重新启动apache,它就无济于事。

有人遇到过这个问题吗?

3 个答案:

答案 0 :(得分:3)

我认为设置ajp连接器的连接超时可以解决您的问题。 像这样的设置应该有效

<Connector port="8009" address="${jboss.bind.address}" protocol="AJP/1.3"
         emptySessionPath="true" enableLookups="false" redirectPort="8443" maxThreads="1000" connectionTimeout="60000000" />

您在server.xml中配置它

有关此属性的更多文档,您可以在官方文档http://docs.jboss.org/jbossweb/latest/config/ajp.html

中阅读

答案 1 :(得分:1)

您是否在server.xml文件中设置了正确的jvmRoute?

jboss-as/server/${profile}/deploy/jbossweb.sar/server.xml

确切的行应如下所示:

<Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1">

并且在第二台服务器上将有jvmRoute =“node2”。

答案 2 :(得分:0)

请按以下步骤解决问题。 1.在不重新启动Web服务器的情况下,从其他浏览器中单击URL。(如果其不起作用,下面的解决方案将为您工作)

请检查两个JBoss配置必须启用8009(AJP)端口。在您的情况下,两个不同的物理服务器中有两个实例。必须配置上述端口。它是默认设置。检查是否被错误更改。基本上,这对应于http偏移量0。