简体   繁体   English

Apache Web服务器多名工作人员

[英]Apache web server multiple workers

We have a webserver running apache 2.2, which connects to tomcat 5.5 in another server (say, repserver ). 我们有一个运行apache 2.2的网络服务器,该服务器连接到另一台服务器(例如repserver )中的tomcat 5.5。 This is done through ajp1.3 protocol, with mod_jk workers.properties file defining an ajp13 worker. 这是通过ajp1.3协议完成的,与mod_jk的 workers.properties文件中定义的AJP13工人。

The workers.properties file contains: workers.properties文件包含:

ps=\
worker.ajp13.type=ajp13
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=#HOSTNAME

The httpd.conf file is using these three lines: httpd.conf文件使用以下三行:

JkMount /* ajp13
JkMount /#Link1/* ajp13
JkMount /#Link2/* ajp13

Now we have another instance of tomcat 7 in the repserver , and we need the webserver to connect to this instance as well. 现在,我们在repserver中有另一个tomcat 7实例,并且我们还需要Web服务器连接到该实例。 I have defined the listening port for ajp as 9009 in this instance of tomcat. 在此tomcat实例中,我已将ajp的侦听端口定义为9009 This contains link3 and link4 . 这包含link3link4

How can I define another worker to connect to these links? 如何定义其他工作人员以连接到这些链接?

You need to define a load balancer in that case: 在这种情况下,您需要定义一个负载均衡器:

Change your workers.properties to this: 将您的worker.properties更改为此:

worker.list=balancer

#lb config
worker.balancer.type=lb
worker.balancer.sticky_session=1
worker.balancer.balance_workers=ajp13,tomcat7

#(ajp13 is not a good name for a worker/server node)
worker.ajp13.type=ajp13
worker.ajp13.port=8009
worker.ajp13.host=#HOSTNAME

worker.tomcat7.type=ajp13
worker.tomcat7.port=9009
worker.tomcat7.host=#IP/HOSTNAME

Open server.xml of Tomcat 7 and define the jvmRoute (do that in Tomcat 5 too, if not still happend): 打开Tomcat 7的server.xml并定义jvmRoute(如果尚未发生,也可以在Tomcat 5中执行此操作):

<Engine jvmRoute="tomcat7" name="Catalina" ...>

Map applications to the new Tomcat 7: 将应用程序映射到新的Tomcat 7:

JkMount /APPLICATION_NAME   balancer
JkMount /APPLICATION_NAME/* balancer

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM