apache jk_mod和tomcat集群做负载均衡简单配置
2014-10-21 22:55
441 查看
刚初步了解了apache的配置,试着用apache和tomcat集群来做负载均衡,记录如下以备参考
一, 用mod_jk来做负载均衡,mod_proxy等模块来实现负载均衡后面再尝试,apache这一边(也就是load balancer)的配置如下
1. apache主配置文件httpd.conf中加入下一行
Include conf/jk-mod.conf
2. 在apache的conf目录下建立jk-mod.conf,内容如下
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel debug
JkMount /* loadbalancer
3. 在apache的conf目录下建立workers.properties,内容如下
worker.list=loadbalancer
worker.tomcat1.port=8009
worker.tomcat1.host=192.168.1.114
worker.tomcat1.type=ajp13
worker.tomcat1.lbfactor=1
worker.tomcat2.port=8010
worker.tomcat2.host=192.168.1.114
worker.tomcat2.type=ajp13
worker.tomcat2.lbfactor=1
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=tomcat1,tomcat2
worker.loadbalancer.sticky_session=False
至此部,负载均衡这一端就简单配置完了,下面来配置tomcat集群这一端
二,tomcat集群构建
1. download tomcat 7 and unpack it to disk with 2 copies, rename to tomcat1, tomcat2(another solution is to launch two different instances based on one copy with different CATALINA_BASE, but it need more steps, for simplicity, I just use 2 different copies)
2. uncomment following lines in server.xml in both copies
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
3. add <distributable/> to web.xml of the app you deployed in both tomcat servers.
4. modify the port in server.xml of tomcat2, including the http connector port, the ajp connector port, the shutdown port and the redirectPort.
ok,至此tomcat集群构建完毕
一, 用mod_jk来做负载均衡,mod_proxy等模块来实现负载均衡后面再尝试,apache这一边(也就是load balancer)的配置如下
1. apache主配置文件httpd.conf中加入下一行
Include conf/jk-mod.conf
2. 在apache的conf目录下建立jk-mod.conf,内容如下
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel debug
JkMount /* loadbalancer
3. 在apache的conf目录下建立workers.properties,内容如下
worker.list=loadbalancer
worker.tomcat1.port=8009
worker.tomcat1.host=192.168.1.114
worker.tomcat1.type=ajp13
worker.tomcat1.lbfactor=1
worker.tomcat2.port=8010
worker.tomcat2.host=192.168.1.114
worker.tomcat2.type=ajp13
worker.tomcat2.lbfactor=1
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=tomcat1,tomcat2
worker.loadbalancer.sticky_session=False
至此部,负载均衡这一端就简单配置完了,下面来配置tomcat集群这一端
二,tomcat集群构建
1. download tomcat 7 and unpack it to disk with 2 copies, rename to tomcat1, tomcat2(another solution is to launch two different instances based on one copy with different CATALINA_BASE, but it need more steps, for simplicity, I just use 2 different copies)
2. uncomment following lines in server.xml in both copies
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
3. add <distributable/> to web.xml of the app you deployed in both tomcat servers.
4. modify the port in server.xml of tomcat2, including the http connector port, the ajp connector port, the shutdown port and the redirectPort.
ok,至此tomcat集群构建完毕
相关文章推荐
- 基于mod_proxy+Apache 2.2.16+Tomcat 7的负载均衡与集群配置 Peter Wei
- 基于mod_proxy+Apache 2.2.16+Tomcat 7的负载均衡与集群配置
- 基于mod_proxy+Apache 2.2.16+Tomcat 7的负载均衡与集群配置
- 基于mod_proxy+Apache 2.2.16+Tomcat 7的负载均衡与集群配置
- (转)基于mod_proxy+Apache 2.2.16+Tomcat 7的负载均衡与集群配置
- 基于mod_proxy+Apache 2.2.16+Tomcat 7的负载均衡与集群配置
- 基于mod_proxy+Apache 2.2.16+Tomcat 7的负载均衡与集群配置
- 基于mod_proxy+Apache 2.2.16+Tomcat 7的负载均衡与集群配置
- nginx + tomcat 集群配置详解, 实现负载均衡 URLRewrite Session复制
- Apache +Tomcat的负载均衡与集群配置
- Nginx + Tomcat 配置集群负载均衡
- Apache+tomcat+mod_jk+centos6.2负载均衡集群配置--转载
- apache+tomcat实现负载均衡与集群的配置
- 图文解说:Nginx+tomcat配置集群负载均衡
- Apache+tomcat+mod_jk+centos6.2负载均衡集群配置
- Nginx+tomcat配置集群负载均衡
- 图文解说:Nginx+tomcat配置集群负载均衡
- apache+tomcat集群的负载均衡配置方式
- 安装集群apache+tomcat实现负载均衡与集群的配置
- Nginx+tomcat配置集群负载均衡