In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "the installation and configuration of Jboss cluster". In the daily operation, I believe that many people have doubts about the installation and configuration of Jboss cluster. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "installation and configuration of Jboss cluster". Next, please follow the editor to study!
Preparatory work
Two PC servers:
Information item
Description
Ip address XXX.XXX.1.59 | XXX.XXX.1.63 system hardware platform PC Server memory 6gCPUIntel (R) Xeon (TM) CPU 3.00GHz * 6 operating system CentOS release 5.5 (Final)
Installation media:
Install and configure JDK
Download JDK (version 1.6)
Installation
1) upload jdk media to the target server (XXX.XXX.1.59) and grant execution permission
[root@XXXHT3 jboss] # chmod + x jdk-6u29-linux-i586-rpm.bin-rwxr--r-- 1 root root 80671698 Apr 25 03:13 jdk-6u29-linux-i586-rpm.bin
one
two
[root@XXXHT3 jboss] # chmod + x jdk-6u29-linux-i586-rpm.bin
-rwxr--r-- 1 root root 80671698 Apr 25 03:13 jdk-6u29-linux-i586-rpm.bin
2) enter the following command to start the installation
[root@XXXHT3 jboss] #. / jdk-6u29-linux-i586-rpm.bin [root@XXXHT3 jboss] # rpm-ivh jdk-6u29-linux-i586.rpm
one
two
[root@XXXHT3 jboss] #. / jdk-6u29-linux-i586-rpm.bin
[root@XXXHT3 jboss] # rpm-ivh jdk-6u29-linux-i586.rpm
3) confirm that jdk has been installed
[root@XXXHT3 jboss] # cd / usr/java/ default/ jdk1.6.0_29/ latest/
one
two
[root@XXXHT3 jboss] # cd / usr/java/
Default/ jdk1.6.0_29/ latest/
Set environment variabl
1) find the. bash_profile file in the user's home directory, and add the following at the end of the file
JAVA_HOME=/usr/java/jdk1.6.0_29 PATH=$JAVA_HOME/bin:$PATH CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar export PATH JAVA_HOME CLASSPATH
one
two
three
four
JAVA_HOME=/usr/java/jdk1.6.0_29
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
Export PATH JAVA_HOME CLASSPATH
Save exit
Log out of the system and log back in or execute the following command
[root@XXXHT3] #. .bash _ profile
one
[root@XXXHT3] #. .bash _ profile
2) after successful installation, enter java-version to check whether the version is correct, and the following information is displayed correctly.
[root@XXXHT3] # java-version java version "1.6.0y29" Java (TM) SE Runtime Environment (build 1.6.0_29-b11) Java HotSpot (TM) Server VM (build 20.4-b02, mixed mode)
one
two
three
four
[root@XXXHT3 ~] # java-version
Java version "1.6.029"
Java (TM) SE Runtime Environment (build 1.6.0_29-b11)
Java HotSpot (TM) Server VM (build 20.4-b02, mixed mode)
Install and configure JBoss environment variables
Download JBoss (jdk6 version of JBoss5 installation package)
Install JBoss
Extract the jboss media file
[root@XXXHT3 jboss] # unzip jboss-5.1.0.GA-jdk6.zip Archive: jboss-5.1.0.GA-jdk6.zip
one
two
[root@XXXHT3 jboss] # unzip jboss-5.1.0.GA-jdk6.zip
Archive: jboss-5.1.0.GA-jdk6.zip
3. Configure JBoss environment variables
Find the. bash_profile file in the user's home directory and add the following at the end of the file
JBOSS_HOME=/data/jboss/jboss-5.1.0.GA PATH=$JBOSS_HOME/bin:$PATH export JBOSS_HOME PATH
one
two
three
JBOSS_HOME=/data/jboss/jboss-5.1.0.GA
PATH=$JBOSS_HOME/bin:$PATH
Export JBOSS_HOME PATH
Save exit
Log out of the system and log back in or execute the following command
[root@XXXHT3] #. .bash _ profile
one
[root@XXXHT3] #. .bash _ profile
Jboss cluster load balancer configuration
Install apache
1) download apache (httpd-2.2.17)
2) decompression
[root@XXXHT3 jboss] # tar-xvf httpd-2.2.17.tar.gz
one
[root@XXXHT3 jboss] # tar-xvf httpd-2.2.17.tar.gz
3) compilation
Enter the extracted apache directory and execute the following command
[root@XXXHT3 httpd-2.2.17] #. / configure
one
[root@XXXHT3 httpd-2.2.17] #. / configure
4) then enter:
Make clean enter make enter make install enter
one
two
three
Make clean enter
Make enter
Make install enter
5) confirm the apache installation directory
[root@XXXHT3 httpd-2.2.17] # cd / usr/local/apache2/ [root@XXXHT3 apache2] # ls bin build cgi-bin conf error htdocs icons include lib logs man manual modules
one
two
three
[root@XXXHT3 httpd-2.2.17] # cd / usr/local/apache2/
[root@XXXHT3 apache2] # ls
Bin build cgi-bin conf error htdocs icons include lib logs man manual modules
6) modify the configuration
Open the / usr/local/apache2/conf/httpd.conf file
Change Listen 80 to Listen 7070
Change User daemon and Group daemon to User apache and Group apache
Change the line to ServerName 127.0.0.1 ServerName 8888 before deleting the line
Then add users and user groups
At the terminal, enter:
Groupadd apache useradd apache-g apache
one
two
Groupadd apache
Useradd apache-g apache
Configuration of apache mod_jk
1) download the mod_jk installation package
Mod_jk download address
Http://tomcat.apache.org/connectors-doc/
2) decompression
[root@XXXHT3 jboss] # tar-xvf tomcat-connectors-1.2.40-src.tar.gz
one
[root@XXXHT3 jboss] # tar-xvf tomcat-connectors-1.2.40-src.tar.gz
3) compile and install
[root@XXXHT3 jboss] # cd tomcat-connectors-1.2.40-src [root@XXXHT3 tomcat-connectors-1.2.40-src] # cd native [root@XXXHT3 native] #. / configure-- with-apxs=/usr/local/apache2/bin/apxs-- with-java-home=/usr/java/jdk1.6.0_29-- with-java-platform=2-- enable-jni [root@XXXHT3 native] # make [root@XXXHT3 native] # make install
one
two
three
four
five
[root@XXXHT3 jboss] # cd tomcat-connectors-1.2.40-src
[root@XXXHT3 tomcat-connectors-1.2.40-src] # cd native
[root@XXXHT3 native] # / configure-- with-apxs=/usr/local/apache2/bin/apxs-- with-java-home=/usr/java/jdk1.6.0_29-- with-java-platform=2-- enable-jni
[root@XXXHT3 native] # make
[root@XXXHT3 native] # make install
4) copy the mod_jk.so package to
[root@XXXHT3 native] # cd apache-2.0/ [root@XXXHT3 apache-2.0] # cp. / mod_jk.so / usr/local/apache2/modules/ cd / usr/local/apache/modules/ chmod 755 mod_jk.so
one
two
three
four
[root@XXXHT3 native] # cd apache-2.0/
[root@XXXHT3 apache-2.0] # cp. / mod_jk.so / usr/local/apache2/modules/
Cd / usr/local/apache/modules/
Chmod 755 mod_jk.so
5) add at the end of / usr/local/apache2/conf/httpd.conf:
Include conf/mod_jk.conf
one
Include conf/mod_jk.conf
6) create the file / usr/local/apache2/conf/uriworkermap.properties and enter:
[root@XXXHT3 conf] # vi uriworkermap.properties / jmx-console=loadbalancer / jmx-console/*=loadbalancer / web-console=loadbalancer / web-console/*=loadbalancer
one
two
three
four
five
[root@XXXHT3 conf] # vi uriworkermap.properties
/ jmx-console=loadbalancer
/ jmx-console/*=loadbalancer
/ web-console=loadbalancer
/ web-console/*=loadbalancer
7) create the file mod_jk.conf in this directory and enter the following:
# Load mod_jk module. Specify the filename # of the mod_jk lib you've downloaded and # installed in the previous section 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 indicate to send SSL KEY SIZE JkOptions + ForwardKeySize + ForwardURICompat-ForwardDirectories # JkRequestLogFormat set the request format JkRequestLogFormat "w% V% T" JkMount / * loadbalancer
one
two
three
four
five
six
seven
eight
nine
ten
eleven
twelve
thirteen
fourteen
fifteen
sixteen
seventeen
# Load mod_jk module. Specify the filename
# of the mod_jk lib you've downloaded and
# installed in the previous section
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 indicate to send SSL KEY SIZE
JkOptions + ForwardKeySize + ForwardURICompat-ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "w V T"
JkMount / * loadbalancer
8) create the file workers.properties in this directory and enter the following:
Worker.list=loadbalancer,node1,node2 # Define the first node... Worker.node1.port=8009 worker.node1.host=XXX.XXX.1.59 worker.node1.type=ajp13 worker.node1.lbfactor=1 worker.node1.local_worker=1 worker.node1.cachesize=10 worker.node1.cache_timeout=600 worker.node1.reply_timeout=100 worker.node1.socket_timeout=300 # Define the second node... Worker.node2.port=8009 worker.node2.host=XXX.XXX.1.63 worker.node2.type=ajp13 worker.node2.lbfactor=1 worker.node2.local_worker=1 worker.node2.cachesize=10 worker.node2.cache_timeout=600 worker.node2.reply_timeout=100 worker.node2.socket_timeout=300 # Now we define the load-balancing behaviour worker.loadbalancer.type=lb worker.loadbalancer.balanced_workers=node1,node2 worker.loadbalancer.sticky_session=0
one
two
three
four
five
six
seven
eight
nine
ten
eleven
twelve
thirteen
fourteen
fifteen
sixteen
seventeen
eighteen
nineteen
twenty
twenty-one
twenty-two
twenty-three
twenty-four
twenty-five
Worker.list=loadbalancer,node1,node2
# Define the first node...
Worker.node1.port=8009
Worker.node1.host=XXX.XXX.1.59
Worker.node1.type=ajp13
Worker.node1.lbfactor=1
Worker.node1.local_worker=1
Worker.node1.cachesize=10
Worker.node1.cache_timeout=600
Worker.node1.reply_timeout=100
Worker.node1.socket_timeout=300
# Define the second node...
Worker.node2.port=8009
Worker.node2.host=XXX.XXX.1.63
Worker.node2.type=ajp13
Worker.node2.lbfactor=1
Worker.node2.local_worker=1
Worker.node2.cachesize=10
Worker.node2.cache_timeout=600
Worker.node2.reply_timeout=100
Worker.node2.socket_timeout=300
# Now we define the load-balancing behaviour
Worker.loadbalancer.type=lb
Worker.loadbalancer.balanced_workers=node1,node2
Worker.loadbalancer.sticky_session=
Description:
Worker.node1.host and worker.node2.host should be changed to the actual IP of each machine in the jboss cluster.
If there are more nodes, define more node segments sequentially and list them all after worker.loadbalancer.balanced_workers.
Lbfactor is the weight of load distribution, the higher the value, the more load is distributed.
Worker.loadbalancer.sticky_session it refers to whether session is adhesive session, if it is 0, it means non-adhesive session,1 represents adhesion.
JBoss cluster node configuration
1) modify server.xml to support all network access
[root@XXXHT3 deploy] # cd / data/jboss/jboss-5.1.0.GA/server/all/deploy/jbossweb.sar [root@XXXHT3 deploy] # vi server.xml
one
two
[root@XXXHT3 deploy] # cd / data/jboss/jboss-5.1.0.GA/server/all/deploy/jbossweb.sar
[root@XXXHT3 deploy] # vi server.xml
Modify
5) modify ssaging-service.xml file
[root@XXXHT3 deploy] # cd / data/jboss/jboss-5.1.0.GA/server/all/deploy/messaging [root@XXXHT3 deploy] # vi messaging-service.xml
one
two
[root@XXXHT3 deploy] # cd / data/jboss/jboss-5.1.0.GA/server/all/deploy/messaging
[root@XXXHT3 deploy] # vi messaging-service.xml
Modify 20 lines
${jboss.messaging.ServerPeerID:1}
one
${jboss.messaging.ServerPeerID:1}
At this time, as long as it is an integer value, it is OK.
Another machine configuration
${jboss.messaging.ServerPeerID:2}
one
${jboss.messaging.ServerPeerID:2}
It should be noted that the ID values of different Node in the same cluster are not the same.
Application project
Web.xml file in war package
Add the following sentence to the web.xml in the war package of your project application
one
Put it on the top floor, as follows
Hello.jsp
one
two
three
four
five
six
seven
eight
nine
ten
eleven
Hello.jsp
Jboss-web.xml file in war package
Under the folder at the same level as web.xml, add the jboss-web.xml file as follows
SET_AND_NON_PRIMITIVE_GET SESSION True
one
two
three
four
five
six
seven
eight
nine
ten
eleven
twelve
SET_AND_NON_PRIMITIVE_GET
SESSION
True
Start the JBoss cluster
Start the load balancer apache
Execute. / httpd-k start in the / usr/local/apache2/bin directory (termination command:. / httpd-k stop)
In / usr/local/apache2/logs/mod_jk.log, see the log where apache initializes the mod_jk:
[Wed Aug 01 10:36:11 2007] [6636 init_jk::mod_jk.c 63168] [info] init_jk::mod_jk.c (2743): mod_jk/1.2.23 initialized [Wed Aug 01 10:36:11 2007] [6637 init_jk::mod_jk.c 63168] [info] Wed Aug (2743): mod_jk/1.2.23 initialized
one
two
three
four
five
six
seven
[Wed Aug 01 10:36:11 2007] [6636 63168] [info] init_jk::mod_jk.c (2743):
Mod_jk/1.2.23 initialized
[Wed Aug 01 10:36:11 2007] [6637 init_jk::mod_jk.c 63168] [info] init_jk::mod_jk.c (2743):
Mod_jk/1.2.23 initialized
If there is an error message later, it is because the node in the cluster has not been started and is ignored for the time being.
Use netstat to check that 7070 listening port exists and apache starts successfully. (netstat-an | grep 7070)
Start the JBoss node
Create a run-all.sh file under ${JBOSS_HOME}\ bin. (remember: the Session assignment is valid only if you start it in the way you configure IP.) the contents are as follows:
Run.sh-c all-b XXX.XXX.1.59
one
Run.sh-c all-b XXX.XXX.1.59
If it is a 63 Node machine, the content is as follows
Run.sh-c all-b XXX.XXX.1.63
one
Run.sh-c all-b XXX.XXX.1.63
Terminate the command:. / shutdown.sh-S
Use netstat to check the existence of port 8080 listening.
Access to port 8080 of each node with a browser, you can see the status of jboss.
Jboss started successfully.
Load balancing and disaster recovery testing
Through the Hello World Mini App, the following cluster load and disaster recovery tests are completed:
Set non-session adhesion statu
Test scenario
Test result
Whether to pass or not
59, 63 two JBoss nodes with normal status will be polled and forwarded to two nodes averagely through 59 nodes down, 63 nodes normal requests forwarded to 63 nodes, can be returned normally through 63 nodes down, 59 nodes normal requests forwarded to 59 nodes, can be returned normally through one of the failed nodes restart requests will be polled and forwarded to two nodes by setting session adhesion status
Test scenario
Test result
Whether to pass or not
The normal requests of 59 and 63 JBoss nodes are only forwarded to one node by 59 nodes down, 63 nodes normal requests are forwarded to 63 nodes, and the normal requests of 59 nodes are forwarded to 59 nodes. The restart requests of 59 nodes can be returned normally and the restart requests of one of the failed nodes are only forwarded to the original normal node by comparing JBoss with WebLogic products.
JBoss
WebLogic
Software fee open source software, free commercial software, free version upgrade version span, need to modify the source code upgrade convenient, basically do not need to modify the cluster installation deployment is more complex simple cluster expansion is relatively simple to manage each node to manage all nodes the same console unified management hot deployment support, but each node for deployment support and more stable One-time deployment of the whole cluster suitable for small and medium-sized application projects, enterprise-level development projects, generally more stable technical support without providing professional technical support, the study on "installation and configuration of Jboss cluster" is over, hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 238
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.