现在的位置: 首页 > 综合 > 正文

jboss 6 集群

2013年07月02日 ⁄ 综合 ⁄ 共 4037字 ⁄ 字号 评论关闭
JBOSS6 集群
2011-09-24 14:28

到apache官网下载 Apache2.2,

下载mod_jk.so放到%APACHE_HOME%\modules目录下

在%APACHE_HOME%\conf目录下httpd.conf文件末尾添加Include conf/mod-jk.conf这行

 

 

在%APACHE_HOME%\conf目录下,新建workers.properties文件

内容如下:

# Define list of workers that will be used
# for mapping requests
worker.list=loadbalancer,status

# Define Node1
# modify the host as your host IP or DNS name.
worker.node1.port=8009
worker.node1.host=172.22.71.133
worker.node1.type=ajp13
worker.node1.lbfactor=1

# Define Node2
# modify the host as your host IP or DNS name.

#下面这个端口是对应JOBSS6  %JBOSS_HOME%\server\all\deploy\jbossweb.sar  server.xml文件里面的ajp的端口,不是8080
worker.node2.port=8009
worker.node2.host=172.22.71.119
worker.node2.type=ajp13
worker.node2.lbfactor=1

# Load-balancing behaviour
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=node1,node2
worker.loadbalancer.sticky_session=1
#worker.list=loadbalancer
# Status worker for managing load balancer
worker.status.type=status

 

继续在%APACHE_HOME%\conf目录下,新建文件uriworkermap.properties

内容如下:

/jmx-console=loadbalancer
/jmx-console/*=loadbalancer
/web-console=loadbalancer
/web-console/*=loadbalancer

 

继续在%APACHE_HOME%\conf目录下新建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
<Location /jkstatus/>
    JkMount status
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
</Location>

 

apache部分配置完毕

 

 

下面开始配置jboss6部分

在%JBOSS_HOME%\server\all\deploy\jbossweb.sar目录下的server.xml文件,修改内容:

原有内容为:

      <!-- A HTTP/1.1 Connector on port 8080 -->
      <Connector protocol="HTTP/1.1" port="${jboss.web.http.port}" address="${jboss.bind.address}"

         redirectPort="${jboss.web.https.port}" />

      <!-- Add this option to the connector to avoid problems with
          .NET clients that don't implement HTTP/1.1 correctly
         restrictedUserAgents="^.*MS Web Services Client Protocol 1.1.4322.*$"
      -->

      <!-- A AJP 1.3 Connector on port 8009 -->
      <Connector protocol="AJP/1.3" port="${jboss.web.ajp.port}" address="${jboss.bind.address}"
         redirectPort="${jboss.web.https.port}" />

 

修改成:注意下面的8009端口就是上面APACHE节点那个端口。。弄了很久才弄明白

 <!-- A HTTP/1.1 Connector on port 8080 -->
      <Connector protocol="HTTP/1.1" port="${jboss.web.http.port}" address="${0.0.0.0}"

         redirectPort="${jboss.web.https.port}" />

      <!-- Add this option to the connector to avoid problems with
          .NET clients that don't implement HTTP/1.1 correctly
         restrictedUserAgents="^.*MS Web Services Client Protocol 1.1.4322.*$"
      -->

      <!-- A AJP 1.3 Connector on port 8009 -->
      <Connector protocol="AJP/1.3" port="${jboss.web.ajp.port}" address="${0.0.0.0}"
         redirectPort="${jboss.web.https.port}" />

 

同时将      <Engine name="jboss.web" defaultHost="localhost">

修改为:      <Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1">

jvmRoute="node1"为节点名称

 

在%JBOSS_HOME%\server\all\deployers\jbossweb.deployer\META-INF目录下的war-deployers-jboss-beans.xml文件,修改内容:

原内容为:

      <property name="useJK">true</property>
      <!--
      <property name="useSessionPassivation">false</property>
      <property name="passivationMaxIdleTime">-1</property>  
      <property name="passivationMinIdleTime">-1</property>
      -->

 

修改为:

      <property name="useJK">true</property>
      <property name="useSessionPassivation">true</property>
      <property name="passivationMaxIdleTime">-1</property>  
      <property name="passivationMinIdleTime">-1</property>

 

即不要开掉注释,以为改false为true

 

同样配置另外几台jboss服务器

 

完毕。。。

抱歉!评论已关闭.