我可以更改 ajp 连接器代替 apache tomcat 中的默认端口 8009 以实现负载平衡吗?

can i change ajp connector in place of default port 8009 in apache tomcat for load balancing?

我正在使用 mod_jk-1.2.31-httpd-2.2.x.so 在 RHEL6 [=27= 上使用 Apcahe 2.2.15 和 apache tomcat 6 的多个实例进行负载平衡] OS。 我已经创建 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

如果调用 Mount 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的多个实例的负载平衡,如果有的话请发送文档。

在RHEL 6中,SELinux默认为强制模式,对于SELinux的访问端口设置模式Permissive

setenforce 0

可以查看SELinux的模式

getenforce