我使用mod_jk-1.2.31-httpd-2.2.x.so负载平衡与Apcahe 2.2.15和多个实例的apache tomcat 6 RHEL6 LINUXOS.我有创建workers.properties
worker.list=stat,balancer
worker.worker1.port=8019
worker.worker1.host=localhost
worker.worker1.type=ajp13
worker.worker1.lbfactor=1
worker.worker2.port=8029
worker.worker2.host=localhost
worker.worker2.type=ajp13
worker.worker2.lbfactor=1
worker.balancer.type=lb
worker.stat.type=status
worker.balancer.balance_workers=worker1,worker2
worker.balancer.method=B
worker.balancer.sticky_session=True
在httpd. conf
LoadModule jk_module modules/mod_jk-1.2.31-httpd-2.2.x.so
# Load workers files from the config directory "/etc/httpd/conf".
JkWorkersFile /etc/httpd/conf/workers.properties
## Path to jk logs
JkLogFile logs/mod_jk.log
JkShmFile run/mod_jk.shm
# Jk log level [debug/error/info]
JkLogLevel info
# 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 /status stat
JkMount /Oa balancer
JkMount /Oa/* balancer
如果调用挂载Webproject Oa然后在日志mod_jk. log
[Thu Dec 03 12:54:41 2015] [22380:140534825461728] [info]
init_jk::mod_jk.c (3198): mod_jk/1.2.31 (1026297) initialized
[Thu Dec 03 12:54:41 2015] [22381:140534825461728] [info]
init_jk::mod_jk.c (3198): mod_jk/1.2.31 (1026297) initialized
[Thu Dec 03 12:54:48 2015] stat newoag.iitk.ac.in 0.000353 [Thu Dec
03 12:55:52 2015] [22385:140534825461728] [info]
jk_open_socket::jk_connect.c (626): connect to 127.0.0.1:8019 failed
(errno=13)
[Thu Dec 03 12:55:52 2015] [22385:140534825461728] [info]
ajp_connect_to_endpoint::jk_ajp_common.c (959): Failed opening
socket to (127.0.0.1:8019) (errno=13)
[Thu Dec 03 12:55:52 2015] [22385:140534825461728] [error]
ajp_send_request::jk_ajp_common.c (1578): (worker1) connecting to
backend failed. Tomcat is probably not started or is listening on
the wrong port (errno=13)
[Thu Dec 03 12:55:52 2015] [22385:140534825461728] [info]
ajp_service::jk_ajp_common.c (2543): (worker1) sending request to
tomcat failed (recoverable), because of error during request sending
(attempt=1)
[Thu Dec 03 12:55:53 2015] [22385:140534825461728] [info]
jk_open_socket::jk_connect.c (626): connect to 127.0.0.1:8019 failed
(errno=13)
[Thu Dec 03 12:55:53 2015] [22385:140534825461728] [info]
ajp_connect_to_endpoint::jk_ajp_common.c (959): Failed opening
socket to (127.0.0.1:8019) (errno=13)
[Thu Dec 03 12:55:53 2015] [22385:140534825461728] [error]
ajp_send_request::jk_ajp_common.c (1578): (worker1) connecting to
backend failed. Tomcat is probably not started or is listening on
the wrong port (errno=13)
[Thu Dec 03 12:55:53 2015] [22385:140534825461728] [info]
ajp_service::jk_ajp_common.c (2543): (worker1) sending request to
tomcat failed (recoverable), because of error during request sending
(attempt=2)
[Thu Dec 03 12:55:53 2015] [22385:140534825461728] [error]
ajp_service::jk_ajp_common.c (2562): (worker1) connecting to tomcat
failed.
[Thu Dec 03 12:55:53 2015] [22385:140534825461728] [info]
service::jk_lb_worker.c (1388): service failed, worker worker1 is in
error state
[Thu Dec 03 12:55:53 2015] [22385:140534825461728] [info]
jk_open_socket::jk_connect.c (626): connect to 127.0.0.1:8029 failed
(errno=13)
[Thu Dec 03 12:55:53 2015] [22385:140534825461728] [info]
ajp_connect_to_endpoint::jk_ajp_common.c (959): Failed opening
socket to (127.0.0.1:8029) (errno=13)
[Thu Dec 03 12:55:53 2015] [22385:140534825461728] [error]
ajp_send_request::jk_ajp_common.c (1578): (worker2) connecting to
backend failed. Tomcat is probably not started or is listening on
the wrong port (errno=13)
[Thu Dec 03 12:55:53 2015] [22385:140534825461728] [info]
ajp_service::jk_ajp_common.c (2543): (worker2) sending request to
tomcat failed (recoverable), because of error during request sending
(attempt=1)
[Thu Dec 03 12:55:53 2015] [22385:140534825461728] [info]
jk_open_socket::jk_connect.c (626): connect to 127.0.0.1:8029 failed
(errno=13)
[Thu Dec 03 12:55:53 2015] [22385:140534825461728] [info]
ajp_connect_to_endpoint::jk_ajp_common.c (959): Failed opening
socket to (127.0.0.1:8029) (errno=13)
请建议我,我可以使用ajp连接器8019,8029…代替默认端口8009吗?它是如何工作的?如果有,请发送文档以在一个系统中对多个tomcat实例进行负载平衡。
在RHEL6中,SELinux是defualt中的强制模式,用于访问端口设置模式Permissive for SELinux
setenforce 0
您可以查看SELinux的模式
getenforce