Apache的mod_jk的负载平衡不工作,但故障转移工作 [英] Apache mod_jk load balancing not working but failover works

查看:303
本文介绍了Apache的mod_jk的负载平衡不工作,但故障转移工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想配置与mod_jk的Apache的负载均衡解决方案。聚类作品,但没有负载均衡。

I am trying to configure an Apache load balancing solution with mod_jk. The clustering works but not load balancing.

我的Apache httpd的2.2服务器上我的笔记本电脑上运行。我有两个VMware虚拟机来宾操作系统。所有这三个是窗口。在VMware机的主机Apache Tomcat服务器服务于Web应用程序。我已经配置httpd.conf文件用了mod_jk和工人性能与工人信息文件。我能够访问使用URL我的Web应用程序:的http://本地主机/网络应用程序的。如果我停下一台服务器然后将应用程序从其他服务。但是不能同时在同一时间。一些提取物如下:

I have Apache httpd 2.2 server running on my laptop. I have two VMWare Virtual Machine Guest Operating systems. All three are windows. The VMware machines hosts Apache Tomcat Server serving the web application. I have configured httpd.conf file with mod_jk and a workers properties file with the worker information. I am able to access my web application using the URL : http://localhost/Web-application . If I stop one server then the application is served from the other. However not both at the same time. Some extracts are below:

httpd.conf文件:

LoadModule jk_module modules/mod_jk.so 
JkWorkersFile conf/workers.properties
JkLogFile "logs/mod_jk.log" 
JkLogLevel info
JkMount /MovieBooking loadbalancer
JkMount /MovieBooking/* loadbalancer

workers.properties文件

workers.tomcat_home=/worker1
workers.java_home=$JAVA_HOME
worker.list=loadbalancer,jkstatus,worker1,worker2

 #Declare Tomcat server workers 1 through n

worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=worker1,worker2
worker.loadbalancer.sticky_session=1

worker.worker1.type=ajp13
worker.worker1.host=192.168.200.244
worker.worker1.port=8109
worker.worker1.lbfactor=1

worker.worker2.type=ajp13
worker.worker2.port=8109
worker.worker2.host=192.168.200.243
worker.worker2.lbfactor=1

worker.jkstatus.type=status

我还设置中的jvmRoute在server.xml文件,在这些服务器上:

I have also set jvmroute in the server.xml files on these servers:

server.xml中

<Engine name="Catalina" defaultHost="localhost" jvmRoute="worker1">         
     <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>

如果需要更多的精华,我可以上传

if any more extracts are required I can upload them

推荐答案

在配置负载均衡(寻找确定我)与粘性会话的方式意味着一旦创建会话,后续请求将被引导到同一个Tomcat实例。您可以通过观察它应与 .worker1 .worker2 追加会话cookie值认识到这一点。这个后缀使用由Apache HTTPD来决定哪些Tomcat实例发送传入请求。

The way you configured load balancing (looking ok to me) with sticky sessions means that once a session is created, subsequent requests will be directed to the same Tomcat instance. You can recognize this by looking at the session cookie values which should be appended with .worker1 or .worker2. This postfix is used by the Apache HTTPD to decide which Tomcat instance to send an incoming request to.

如果没有会话cookie,请求应可用雄猫中的循环方式分发。因此,为了测试负载balacing,你通常需要持不同的会话cookie浏览器的一些实例。或尝试设置 sticky_session = FALSE 看的所有的请求转发循环赛的风格。

If there is no session cookie, requests should be distributed among the available Tomcats in a round-robin fashion. So in order to test load-balacing, you will typically need several browser instances holding different session cookies. Or try setting sticky_session=false to see all requests forwarded round-robin style.

这篇关于Apache的mod_jk的负载平衡不工作,但故障转移工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆