Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2764743
  • 博文数量: 587
  • 博客积分: 6356
  • 博客等级: 准将
  • 技术积分: 6410
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-23 10:54
个人简介

器量大者,福泽必厚

文章分类

全部博文(587)

文章存档

2019年(3)

2018年(1)

2017年(29)

2016年(39)

2015年(66)

2014年(117)

2013年(136)

2012年(58)

2011年(34)

2010年(50)

2009年(38)

2008年(16)

分类: LINUX

2010-04-27 14:00:00

apache+tomcat(另一个tomcat做备份)
留为自己的笔记:
1:在172.17.61.124上安装apache2.2,过程省略!
2:在172.17.61.123上安装两个tomcat服务。必须修改三个端口才能保证,一台机器上两个tomcat的正常运行!
修改的端口号分别为
8005 #用于监听关闭的信号
8080 #用户监听用户的请求
8009 #用户和apache或iis进行通讯
3:修改apache2的配置文件,在/usr/local/apache2.2/conf/httpd.conf文件中修改(我将apache安装在/usr/local/apache2.2目录下)
在文件最后加入:
 

Include conf/mod_jk.conf


在/usr/local/apache2.2/conf目录下创建mod_jk.conf文件,内容为:

 

[root@localhost conf]# cat mod_jk.conf ##内容如下:
# Load mod_jk module
# Update this path to match your modules location
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
# Update this path to match your conf directory location (put workers.properties next to httpd.conf)
JkWorkersFile conf/workers.properties
# Where to put jk shared memory
# Update this path to match your local state directory or logs directory
JkShmFile logs/mod_jk.shm
# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to access_log)
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# Send everything for context /examples to worker named worker1 (ajp13)
JkMount /* router

/usr/local/apache2.3/conf中创建workers.properties文件:
workers.properties内容如下:

  ##As long as the "real" workers should only be used via the load balancer worker, there is no need to also put them into the worker.list property.

# The advanced router LB worker
worker.list=router

# Define a worker using ajp13
worker.worker1.port=7009
worker.worker1.host=172.17.61.123
worker.worker1.type=ajp13
worker.worker1.lbfactor=1
# Define preferred failover node for worker1
worker.worker1.redirect=worker2 ##如果worker1 宕机,则把请求叫给worker2处理

# Define another worker using ajp13
worker.worker2.port=8009
worker.worker2.host=172.17.61.123
worker.worker2.type=ajp13
worker.worker2.lbfactor=1
# Disable worker2 for all requests except failover
worker.worker2.activation=disabled  ##当worker1 正常工作时,worker2”休息“

# Define the LB worker
worker.router.type=lb
worker.router.balanced_workers=worker1,worker2

worker2相当于worker1的备份!当worker1对应的服务break down后,它才取代worker1进行工作!

还要在{tomcat_home}/conf/server.xml中进行配置:

[root@localhost conf]# cat server.xml | grep -n jvm
136:     

另一tomcat修改的部分如下:

[root@localhost conf]# cat server.xml | grep -n jvm
136:            
这个必须和workers.properties中的worker想对应!


4:分别启动apache和两个tomcat,(因为我是用tomcat5.5.26和tomcat5.5.27),故

,会有”小猫“的标记并显示5.5.26的版本号,当然tomcat5.5.26正常工作时,无论多少个请求,全部交给tomcat5.5.26来处理, 当我手动去kill掉tomcat5.5.26进程后,再次运行,就会发现“小猫”的标记,并显示5.5.27的标记

阅读(2714) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~