JBoss 6 Cluster

Source: Internet
Author: User
Tags jboss
Jboss6 Cluster

Download apache2.2 from the Apache website,

Download mod_jk.so and put it in the % apache_home % \ modules directory.

Add include CONF/mod-jk.conf to the end of httpd. conf file under % apache_home % \ conf

 

 

Create the workers. properties file in the % apache_home % \ conf directory.

The content is as follows:

# 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.

# The following port corresponds to the AJP port in the jobss6 % jboss_home % \ Server \ All \ deploy \ jbossweb. Sar server. xml file, not 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

 

Create the file uriworkermap. properties in the directory % APACHE_HOME % \ conf.

The content is as follows:

/Jmx-console = loadbalancer
/Jmx-console/* = loadbalancer
/Web-console = loadbalancer
/Web-console/* = loadbalancer

 

Create mod_jk.conf in the % APACHE_HOME % \ conf directory.

The content is as follows:

# 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 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 configuration is complete

 

 

Configure jboss6

In the server. xml file under the % JBOSS_HOME % \ server \ all \ deploy \ jbossweb. sar directory, modify the content:

Original content:

<! -- 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
. 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}"/>

 

Modify to: note that the following port 8009 is the port on the APACHE node above .. It took a long time to figure it out.

<! -- 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
. 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">

Changed to: <Engine name = "jboss. web" defaultHost = "localhost" jvmRoute = "node1">

JvmRoute = "node1" is the node name.

 

In the META-INF file under the % JBOSS_HOME % \ server \ all \ deployers \ jbossweb. deployer \ war-deployers-jboss-beans.xml directory, modify the content:

Original content:

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

 

To:

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

 

That is, do not open comments to set false to true.

 

Configure several other jboss servers

 

Finished...

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.