Chinaunix首页 | 论坛 | 博客
  • 博客访问: 368861
  • 博文数量: 245
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: -10
  • 用 户 组: 普通用户
  • 注册时间: 2016-08-24 23:21
文章分类

全部博文(245)

文章存档

2017年(2)

2014年(6)

2013年(1)

2011年(15)

2010年(68)

2009年(153)

分类: 系统运维

2009-07-02 11:43:14


系统环境:

OS:linux AS4 2.6.9-78.EL

APP: apache httpd-2.2.11.tar.gz

Jboss 4.2.3

需要mod_jk-1.2.28-httpd-2.2.X.so文件

一、Apache的安装配置
1、解压apache

tar zxvf httpd-2.2.11.tar.gz

2、编译apache

./configure –prefix=/usr/local/apache2 –enable-module=so –enable-module=setenvif –enable-module=rewrite –enable-rewrite=shared –enable-proxy=shared –with-mpm=prefork –enable-so –enable-auth-anon –enable-file-cache=shared –enable-cache=shared –enable-disk-cache=shared –enable-mem-cache=shared

make clean

make make

install

 

3、修改httpd.conf文件

vi /usr/local/apache2/conf/httpd.conf
Listen80此端口可以根据实际情况进行修改,此我没有修改我使用的是80

User daemonGroup daemon改为

User apache

Group apache

删除ServerName#(注释)此处注意你如何修改了端口,最好加上端口。
 
4、linux下建立apache组和用户

groupadd apache
useradd apache –g apache
5、将下载的mod_jk-1.2.28-httpd-2.2.X.so文件修改并拷贝

mv mod_jk-1.2.28-httpd-2.2.X.so mode_jk (进行改名)

cp mode_jk /usr/local/apache2/modules (拷贝到这个modules下)

chmod +x /usr/local/apache2/modules/mode_jk

进入到/usr/local/apache2/conf目录下,修改httpd.conf文件

httpd.conf最末尾增:
Include conf/mod_jk.conf
检查httpd.conf里有没有

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_http_module modules/mod_proxy_http.so

LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

 LoadModule proxy_balancer_module modules/mod_proxy_balancer.so

LoadModule status_module modules/mod_status.so

以上内容添加如下内容

       Order deny,allow

       allow from all

ProxyPass / balancer://proxy/   stickysession=JSESSIONID nofailover=On lbmethod=byrequests

ProxyPassReverse / balancer://proxy/

        BalancerMember ajp://192.168.133.133:8009/  loadfactor=50  route=note1

        BalancerMember ajp://192.168.133.233:8009/  loadfactor=50  route=note2

6、新建mod_jk.conf文件文件内容:

#Load mod_jk module

# Specify the filename of the mod_jk lib

LoadModule jk_module modules/mod_jk.so

 

# Where to find workers.properties

JkWorkersFile conf/workers.properties

 

# Where to put jk logs

JkLogFile logs/mod_jk.log

 

# Set the jk log level [debug/error/info]

JkLogLevel info

 

# Select the log format

JkLogStampFormat  "[%a %b %d %H:%M:%S %Y]"

 

# JkOptions indicates to send SSK KEY SIZE

JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

 

# JkRequestLogFormat

JkRequestLogFormat "%w %V %T"

             

# Mount your applications

JkMount /*.* loadbalancer

 

# You can use external file for mount points.

# It will be checked for updates each 60 seconds.

# The format of the file is: /url=worker

# /examples/*=loadbalancer

JkMountFile conf/uriworkermap.properties             

 

# Add shared memory.

# This directive is present with 1.2.10 and

# later versions of mod_jk, and is needed for

# for load balancing to work properly

JkShmFile logs/jk.shm

            

# Add jkstatus for managing runtime data

    JkMount status

    Order deny,allow

    Deny from all

    Allow from 127.0.0.1

  

7、新建workers.properties文件内容如下
# Define list of workers that will be used
# for mapping requests
worker.list=loadbalancer,status
# worker.list=loadbalancer,node1,node2
 
# Define Node1
# modify the host as your host IP or DNS name.
worker.node1.port=8009
worker.node1.host=192.168.133.133
worker.node1.type=ajp13
worker.node1.lbfactor=1
worker.node1.cachesize=100
 
# Define Node2
# modify the host as your host IP or DNS name.
worker.node2.port=8009
worker.node2.host= 192.168.133.233
worker.node2.type=ajp13
worker.node2.lbfactor=1
worker.node2.cachesize=100
 
# Load-balancing behaviour
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=node1,node2
#1表示使用粘着0表示非粘着
worker.loadbalancer.sticky_session=0
#worker.list=loadbalancer
 
# Status worker for managing load balancer
worker.status.type=status
说明:
上面的文件中配置了两个节点,name分别为node1node2,指定两个节点的IP,并在worker.loadbalancer.balance_workers中指定所有的node列表;worker.loadbalancer.sticky_session设置是否启用“粘着的”Sessionsticky session是指来自同一IP的请求将被发送到同一个Jboss节点,sticky session设为0的话同一session的不同请求会被负载均衡分发到不同的jboss节点上。worker.node1.hostworker.node2.host要改成jboss集群各机器的实际IP.
8、新建uriworkermap.properties文件内容如下

/jmx-console=loadbalancer

/jmx-console/*=loadbalancer

/web-console=loadbalancer

/web-console/*=loadbalancer

 
二、Jboss的安装配置
1、JDK安装和环境变量配置我在这里就不再叙述了,大家可以上网查查,很简单。
2、解压JBOSS包我也不在叙述
3、有关JBOSS安装我也不叙述了,我这里直接说明有关JBOSS的配置
4、我在这里jobss/usr/local/jboss目录为例
5、修改JBOSS端口和配置文件
进入到/usr/local/jboss/server/all/deploy/jboss-web.deployer/目录下
l        打开server.xml文件,修改如下
JBOSS_HOME/server/all/deploy/jboss-web.deployer/server.xml
阅读(829) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~