JBoss 5.1 - Chapter 04 - Web Application Deployment

From Training Material
Jump to navigation Jump to search
Title
Web Application Deployment
Author
Bernard Szlachta (NobleProg Ltd)

Configuring Load Balancer with Apache ⌘

Installing Apache Server ⌘

Install Apache server
yum install httpd

Installing mod_jk ⌘

There are two ways of installing the mod_jk

  1. Via RPM
  2. zip

For more information: https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Web_Server/1.0/pdf/Installation_Guide/JBoss_Enterprise_Web_Server-1.0-Installation_Guide-en-US.pdf

mod_jk configuration ⌘

in conf.d create mod_jk.conf

LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties

JkLogFile logs/mod_jk.log
JkLogLevel info
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
#JkMount /xplanner-plus/* loadbalancer

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


#LoadModule mod_rewrite_module modules/mod_rewrite.so
#
#Listen 80
#NameVirtualHost *:80 

#<VirtualHost *:80>
#     ServerName xplanner.nobleprog.com
#    RewriteEngine on
#    RewriteLog logs/apache-mod_rewrite
#    RewriteRule ^/(.*)$ /xplanner-plus/$1 [L,PT]
#    JkMount  /* loadbalancer
#</VirtualHost>


We need configuration of workers as well. In the config above, we declared that it will be stored in conf/workers/properties file.

# 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=localhost
worker.node1.type=ajp13
worker.node1.lbfactor=1
worker.node1.cachesize=10

# Define Node2
# modify the host as your host IP or DNS name.
#worker.node2.port=8009
#worker.node2.host= node2.mydomain.com
#worker.node2.type=ajp13
#worker.node2.lbfactor=1
#worker.node2.cachesize=10

# Load-balancing behaviour
worker.loadbalancer.type=lb

#worker.loadbalancer.balance_workers=node1,node2
worker.loadbalancer.balance_workers=node1

worker.loadbalancer.sticky_session=1
#worker.list=loadbalancer

# Status worker for managing load balancer
worker.status.type=status

Configuring Jboss ⌘

In server/default/deploy/jbossweb.sar/server.xml add following name of the node:

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

More Information: https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Web_Server/1.0/pdf/HTTP_Connectors_Load_Balancing_Guide/JBoss_Enterprise_Web_Server-1.0-HTTP_Connectors_Load_Balancing_Guide-en-US.pdf