1:- Stop httpd Server if running (service httpd stop).
2:- Go to /etc/httpd/modules/ and paste mod_jk-1.2.28-httpd-2.2.X.so file to it.
3:- Go to /etc/httpd/conf and create file workers.properties into it with content.
###Workerfor10.167.19.21,JVMRoute:tomcatA
worker.tomcatA.port=8009
worker.tomcatA.host=10.167.19.21
worker.tomcatA.type=ajp13
worker.tomcatA.lbfactor=1
worker.tomcatA.socket_keepalive=true
worker.tomcatA.ping_mode=I
worker.tomcatA.recovery_options=8
###########################################
###Workerfor10.167.19.30,JVMRoute:tomcatB
worker.tomcatB.port=8009
worker.tomcatB.host=10.167.19.19
worker.tomcatB.type=ajp13
worker.tomcatB.lbfactor=1
worker.tomcatB.socket_keepalive=true
worker.tomcatB.ping_mode=I
worker.tomcatB.recovery_options=8
###########################################
###LoadBalanceconfigurationforloadBalancer_1
worker.loadBalancer_1.type=lb
worker.loadBalancer_1.method=Request
worker.loadBalancer_1.sticky_session=1
worker.loadBalancer_1.sticky_session_force=1
worker.loadBalancer_1.balance_workers=tomcatA,tomcatB
worker.loadBalancer_1.retries=3
###LoadBalanceListconfiguration
worker.status.type=status
worker.list=status,loadBalancer_1
4:- HostName and port(AJP posts) must be according to your tomcat's installed on different server you can have more than two workers according to your number of tomcat's in load balanced environment.
5:- In your alfresco server go to /tomcat/conf/ and modify server.xml file.
First Server:- <Engine name="Catalina" defaultHost="localhost"> to <Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcatA">.
Second Server:- <Engine name="Catalina" defaultHost="localhost"> to <Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcatB">.
6:- Restart both server if running.
7:- Modify /etc/httpd/conf/httpd.conf to include at the end.
# Include mod_jk's specific configuration file.
Include conf/mod_jk.conf
# CoreDumpDirectory Setting.
CoreDumpDirectory /var/tmp
# Include mod_deflate specific configuration file
Include conf/mod_deflate.conf
8:- Include /etc/httpd/conf/mod_jk.conf file and add content.
### mod_jk configuration Starts
## Load mod_jk module for Load balancing & failover configurations
LoadModule jk_module modules/mod_jk-1.2.28-httpd-2.2.X.so
### mod_jk worker property file path
JkWorkersFile conf/workers.properties
### Define the mod_jk log File Path
JkLogFile logs/mod_jk.log
JkLogFile "|/usr/sbin/rotatelogs /var/log/httpd/mod_jk.log.%Y%m%d 86400"
### Define Log Level
JkLogLevel debug
JkLogStampFormat "{%a %b %d %H:%M:%S %Y}"
JkRequestLogFormat "%w %V %T"
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
### Server-status file for checking server up & running status
#JkMount /share/* loadBalancer_1
### Status Web files
### JkUnMount <URL Pattern>
### Shared memory file
JkShmFile /tmp/jk.shm
### mod_jk's administrative page
<Location /jkstatus>
JkMount status
Order deny,allow
Allow from All
</Location>
NameVirtualHost *:80
Include conf/10.167.19.21_vhost.conf
9:- Ip Address must be your apache server IPAddress.
10:- Create file /etc/httpd/conf/virtualhost.conf with following content.
<VirtualHost *:80>
ServerName SERVER_NAME
ServerAlias SERVER_NAME
### JkMount <URL Pattern> <Load Balnacer name>
JkMount /jkstatus status
JkMount /server-status.jsp loadBalancer_1
#JkMount/ab tomcatB
## Application mount points
11:- Create file /etc/httpd/conf/mod_deflate.conf with following content.
#Mod_deflate Configuration
#### mod_deflate Config
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%) "%{User-agent}i"' deflate
CustomLog logs/deflate_log deflate
DeflateCompressionLevel 6
<Directory />
# Insert filter
SetOutputFilter DEFLATE
</Directory>
<Location />
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</Location>
## End of mod_deflate Config
12:- Restart apache server after starting tomcat server.
13:- Check URL :- http://10.167.19.21/jkstatus for checking status of all the workers.
14:- Check URL :- http://10.167.19.21/share for checking the routing od apache to different servers.
15:- Feel the magic.
No comments:
Post a Comment