辅助 ajp 工作程序无法在 apache 和 tomcat 之间工作
我已经让它工作了几个月了,但今天我进行了一次电源循环,但有些东西坏了。抱歉,这有点详细和具体,但我迫切需要帮助。
我有 apache-2.2 和两个 tomcat-6 服务器(只是从两个单独的文件夹运行)。我没有任何 http 连接器,但我在每台服务器上的端口 8009 和 8010 上运行一个 ajp 连接器。启动后,两台 tomcat 都报告连接器正在运行,并且似乎没有任何问题:
INFO: JK: ajp13 listening on /0.0.0.0:8009
...
INFO: JK: ajp13 listening on /0.0.0.0:8010
我相当确定我我的工作人员和 apache 配置是否正确设置。我可以很好地连接到 8009 上的连接器,一点问题都没有,但是当我尝试 8010 apache 时,它给了我一个 503。检查日志(mod_jk.log)它说:
jk_open_socket::jk_connect.c (594): connect to 127.0.0.1:8010 failed (errno=13)
ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (127.0.0.1:8010) (errno=13)
ajp_send_request::jk_ajp_common.c (1507): (eis) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=13)
但我无法理解的是,如果我执行一个简单的 telnet到该端口并发送 GET:
# telnet 127.0.0.1 8010
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
GET
Connection closed by foreign host.
它命中了正确的 tomcat (错误是预期的):
Oct 25, 2011 6:17:10 PM org.apache.jk.common.MsgAjp processHeader
SEVERE: BAD packet signature 18245
Oct 25, 2011 6:17:10 PM org.apache.jk.common.ChannelSocket processConnection
SEVERE: Error, processing connection
那么为什么 apache 无法到达它?无论我是否是超级用户,telnet 都可以工作。可能发生什么事?我完全被难住了。
我尝试重新启动 apache 和 tomcat,但没有任何变化。感谢您的浏览。
EDIT-1:对此进行快速更新...我添加了一个 http 连接器,它工作正常,但 ajp 连接器仍然失败。
EDIT-2:这是每个请求的配置详细信息...
workers.properties:httpd.conf
worker.list=service1,service2
worker.service1.type=ajp13
worker.service1.host=127.0.0.1
worker.service1.port=8009
worker.service2.type=ajp13
worker.service2.host=127.0.0.1
worker.service2.port=8010
(我看到jkmount和JkMount...大写重要吗?):
JkMount /s1 service1
JkMount /s1/* service1
JkMount /s2 service2
JkMount /s2/* service2
service1的server.xml:
<Connector port="8009" protocol="AJP/1.3" />
service2的server.xml:
<Connector port="8010" protocol="AJP/1.3" />
I我想就是这样。
I've had this working for months but I had a power cycle today and something broke. Sorry, this is a bit detailed and specific, but I'm desperate for help.
I have apache-2.2 and two tomcat-6 servers (simply running from two separate folders). I don't have any http connectors but I have one ajp connector running on each server on ports 8009 and 8010. Upon startup both tomcats report the connector is running and there doesn't seem to be any problem:
INFO: JK: ajp13 listening on /0.0.0.0:8009
...
INFO: JK: ajp13 listening on /0.0.0.0:8010
I'm reasonably sure I have my workers and apache configuration setup correctly. I can reach the connector on 8009 fine, no problems at all, but when I try 8010 apache gives me a 503. Checking the log (mod_jk.log) it says:
jk_open_socket::jk_connect.c (594): connect to 127.0.0.1:8010 failed (errno=13)
ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (127.0.0.1:8010) (errno=13)
ajp_send_request::jk_ajp_common.c (1507): (eis) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=13)
But what I can't understand is if I do a simple telnet to that port and send a GET:
# telnet 127.0.0.1 8010
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
GET
Connection closed by foreign host.
It hits the correct tomcat (the error is expected):
Oct 25, 2011 6:17:10 PM org.apache.jk.common.MsgAjp processHeader
SEVERE: BAD packet signature 18245
Oct 25, 2011 6:17:10 PM org.apache.jk.common.ChannelSocket processConnection
SEVERE: Error, processing connection
So why can't apache reach it? The telnet works whether I'm a super user or not. What could be going on? I'm completely stumped.
And I've tried restarting both apache and tomcat and nothing changes. Thanks for taking a look.
EDIT-1: Quick update to this ... I added an http connector and it works fine but the ajp connector is still failing.
EDIT-2: Here are the config details per request ...
workers.properties:
worker.list=service1,service2
worker.service1.type=ajp13
worker.service1.host=127.0.0.1
worker.service1.port=8009
worker.service2.type=ajp13
worker.service2.host=127.0.0.1
worker.service2.port=8010
httpd.conf (I see both jkmount and JkMount ... does caps matter?):
JkMount /s1 service1
JkMount /s1/* service1
JkMount /s2 service2
JkMount /s2/* service2
server.xml for service1:
<Connector port="8009" protocol="AJP/1.3" />
server.xml for service2:
<Connector port="8010" protocol="AJP/1.3" />
I think that's it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的系统上有 SELinux 吗?您可以尝试一下:
它可能会阻止 apache 进程连接。另外,检查您的防火墙规则...
Do you have SELinux on the system? Can you try:
It could be preventing the apache process to connect. Also, check your firewall rules...
默认情况下selinux开放8009,您可以开放更多端口使用。
[goalin@centos63 日志]$ sudo semanage port -l | grep 8009
http_port_t tcp 80, 443, 488, 8008, 8009, 8443
[goalin@centos63 日志]$ sudo
Semanage 端口 -a -t http_port_t -p tcp 18009 [goalin@centos63 日志]$ sudo Semanage 端口 -a -t http_port_t - p tcp 28009
[goalin@centos63 日志]$ sudo semanage port -l | tcp 28009 [goalin@centos63 日志]$ grep 8009
http_port_t tcp 28009, 18009, 80, 443, 488, 8008, 8009, 8443
[goalin@centos63 日志]$
By default 8009 is opened by selinux, you can open more ports to use.
[goalin@centos63 logs]$ sudo semanage port -l | grep 8009
http_port_t tcp 80, 443, 488, 8008, 8009, 8443
[goalin@centos63 logs]$ sudo semanage port -a -t http_port_t -p tcp 18009
[goalin@centos63 logs]$ sudo semanage port -a -t http_port_t -p tcp 28009
[goalin@centos63 logs]$ sudo semanage port -l | grep 8009
http_port_t tcp 28009, 18009, 80, 443, 488, 8008, 8009, 8443
[goalin@centos63 logs]$