Jboss4.2.3 cluster configuration method

Source: Internet
Author: User
I. preparations for JDK1.5 or later installation, Jboss4.2.3, apache2.2.x, mod_jk.so configure JAVA_HOME, JBOSS_HOME, in the APACHE_HOME environment variable, mod_jk is the plug-in used by the apache server to connect to Jboss. 2. the configuration assumes that jbo is installed on both servers... i. preparations
 
Install JDK 1.5 or later, Jboss 4.2.3, apache 2.2.x, mod_jk.so
Configure the JAVA_HOME, JBOSS_HOME, and APACHE_HOME environment variables
Mod_jk is the plug-in for connecting apache server to Jboss.
 
II. configuration
Assume that jboss is installed on both servers. the IP addresses are 192.168.1.100 and 192.168.1.101 respectively.
To clarify the configuration steps, we use the configuration directory $ JBOSS_HOME/server/default instead of directly using the configuration directory $ JBOSS_HOME/server/all. Because the default configuration does not support clusters, you must first copy some dependency packages and configuration files configured for all to the defaut configuration directory.
 
2.1 Copy the dependency packages and configuration files for the cluster
Set jbossha under $ JBOSS_HOME/all/lib. jar, jgroups. jar and jboss-cache-jdk50.jar copy to $ JBOSS_HOME/default/lib Directory, copy the cluster-service.xml and jboss-web.cluster.sar folders in the $ JBOSS_HOME/server/all/deploy directory to the $ JBOSS_HOME/server/default/deploy directory. the same operation is performed on another server.

Jbossha. jar is used to load org. jboss. ha. framework. server. ClusterPartition,
Jgroups. jar is used to support the underlying communication of Jboss clusters.
The jboss-cache-jdk50.jar is used to load org. jboss. cache. aop. TreeCacheAop
2.2 modify the configuration file
Open $ JBOSS_HOME/server/default/deploy/jboss-web.deployer/server. xml and set Change . JvmRoute is used for the Apache server to identify the node name (the name can be used as long as it is the same as the node name specified in the following configuration file workers. properties ). Similarly, change the server. xml file of another server (note: The node name cannot be repeated.
Open $ JBOSS_HOME/server/default/deploy/jboss-web.deployer/ROOT. war/WEB-INF/web. xml, in Add at the end Mark
Open $ JBOSS_HOME/server/default/deploy/jboss-web.deployer/META-INF/jboss-service.xml, put falseIn this case, the sticky sesson policy is used, that is, each session is processed by a specific jboss.
Configure a Java Web application project. Add a WEB-INF in the jboss-web.xml folder of the Java Web application project with the following content:
01

02
03
"-// JBoss // DTD Web Application 4.2 // EN"
04
Http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd>
05

06

07
SET_AND_NON_PRIMITIVE_GET
08
SESSION
09
True
10

11
/Jspdemo
12

Configure Apache server
A) open $ APACHE_HOME/conf/httpd. conf and add the following configuration at the end:
 
01
# Load the mod_jk.so module
02
LoadModule jk_module modules/mod_jk.so
03
 
04
#
05
# Configure the mod_jk.so module
06
#
07
JkWorkersFile conf/workers. properties
08
# Specify which requests are handled by jboss
09
JkMountFile conf/uriworkermap. properties
10
# Mod_jk plug-in logs
11
JkLogFile logs/mod_jk.log
12
# Mod_jk log level
13
JkLogLevel warn
B) create the $ APACHE_HOME/conf/workers. properties file with the following content:
 
01
# Define list of workers that will be used
02
# For mapping requests
03
Worker. list = loadbalancer, status
04
# Define Node1
05
# Modify the host as your host IP or DNS name and your AJP 1.3 port
06
Worker. node1.port = 6009
07
Worker. node1.host = 127.0.0.1
08
Worker. node1.type = ajp13
09
Worker. node1.lbfactor = 1
10
Worker. node1.socket _ timeout = 60
11
Worker. node1.connection _ pool_timeout = 60
12
Worker. node1.ping _ mode =
13
Worker. node1.ping _ timeout = 20000
14
Worker. node1.connect _ timeout = 20000
15
 
16
# Define Node2
17
# Modify the host as your host IP or DNS name and your AJP 1.3 port
18
Worker. node2.port = 7009
19
Worker. node2.host = 127.0.0.1
20
Worker. node2.type = ajp13
21
Worker. node2.lbfactor = 1
22
Worker. node2.socket _ timeout = 60
23
Worker. node2.connection _ pool_timeout = 60
24
Worker. node2.ping _ mode =
25
Worker. node2.ping _ timeout = 20000
26
Worker. node2.connect _ timeout = 20000
27
 
28
# Load-balancing behaviour
29
Worker. loadbalancer. type = lb
30
Worker. loadbalancer. balance_workers = node1, node2
31
Worker. loadbalancer. sticky_session = true
32
Worker. loadbalancer. sticky_session_force = false
33
 
34
# Status worker for managing load balancer
35
Worker. status. type = status
C) create the $ APACHE_HOME/conf/uriworkermap. properties file with the following content:
 
01
# All requests are forwarded to the server load balancer (mod_jk.so ).
02
/* = Loadbalancer
03
 
04
# You can declare that requests to some static resources do not need to be handed over to jboss for processing. in this case, you need to copy these static resources (such as gif, jpg, css, and other files)
05
# Deployment Directory of the Apache server
06
#! /*. Gif = loadbalancer
07
#! /*. Jpg = loadbalancer
08
#! /*. Png = loadbalancer
09
#! /*. Css = loadbalancer
10
#! /*. Js = loadbalancer
11
#! /*. Htm = loadbalancer
12
#! /*. Html = loadbalancer
D) copy mod_jk.so to $ APACHE_HOME/modules.
 
III. test
 
Deploy the same Java Web project on two Jboss servers (for example, record the JSP page access times through session cache ). Start Apache and test Jboss.

Patriot blog

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.