After a long long time search and configuring testing finally i have got a better clustering method which is meet my requirements! i am happy now as it is my long time hunting.... finally it success
i am just posting it here for future myself & if it might help anybody else .
In this cluster i used two tomcat servers & one apache server.
Machines
Apache
IP 192.168.10.100
Tomcat
IP 192.168.10.201
IP 192.168.10.202
Packages that i have installed
###############################################
Tomcat:
tomcat6-servlet-2.5-api-6.0.26-27.fc14.noarch
tomcat6-jsp-2.1-api-6.0.26-27.fc14.noarch
tomcat6-el-2.1-api-6.0.26-27.fc14.noarch
tomcat6-lib-6.0.26-27.fc14.noarch
tomcat6-6.0.26-27.fc14.noarch
HTTPD
httpd-tools-2.2.17-1.fc14.i686
system-config-httpd-1.5.2-2.fc14.noarch
httpd-2.2.17-1.fc14.i686
and mod_jk
from this location
wget http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.31/i386/mod_jk-1.2.31-httpd-2.2.x.so
#################################################
Configuration Files
Tomcat
/etc/tomcat6/server.xml
/etc/tomcat6/context.xml
HTTPD
/etc/httpd/conf/httpd.conf
##################################################
Open the tomcat configuration file (server.xml )
And add the contents like this given below.
vim /etc/tomcat6/server.xml
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
connectionTimeout="20000"
redirectPort="8443" />
resourceName="UserDatabase"/>
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
directory="logs" prefix="common_access_log."
suffix=".txt" pattern="common" resolveHosts="false"/>
className="org.apache.catalina.ha.tcp.SimpleTcpCluster">
expireSessionsOnShutdown="false"
notifyListenersOnReplication="true"/>
className="org.apache.catalina.tribes.membership.McastService"
dropTime="3000"
frequency="500"
port="45564"/>
autoBind="100"
className="org.apache.catalina.tribes.transport.nio.NioReceiver"
maxThreads="6"
port="4000"
selectorTimeout="5000"/>
filter=""/>
tempDir="${catalina.base}/temp/"
deployDir="${catalina.base}/webapps/"
watchDir="${catalina.base}/dir/"
watchEnabled="true"/>
:wq!
##################################################################################
In this case what are the apps comes under the webapps that all will be clustered in my case i had only my apps i have removed all default webapps.
Then scp the same file to second tomcat
and then change the followings jvmRoute=www1 to jvmRoute=www2 & watchEnabled="true" to watchEnabled="false"
watchEnabled field will check for the war files under this "${catalina.base}/dir/" location and if war file is uploaded it will deploy to the second server when you start the servers so in the second server don't forget to change the value from true to false.
(In my case in both the side i changed it false as i found some session failing error after the testing and i upload the war files manually)
##################################################
then next configuration file
vim /etc/tomcat6/context.xml
##################################################
scp to next host ...
Thats it.....
Now Apache configuration
##################################################
add the following on the conf file
vim /etc/httpd/conf/httpd.conf
LoadModule jk_module modules/mod_jk-1.2.31-httpd-2.2.x.so
JkWorkersFile conf/workers.properties
JkLogFile logs/jk.log
JkLogLevel debug
#
JkMount /* router
JkMount /jk_status status
:wq!
###################################################
Then create the file /etc/httpd/conf/workers.properties
vim /etc/httpd/conf/workers.properties
worker.list=router,status
worker.worker1.port=8009
worker.worker1.host=192.168.10.201
worker.worker1.type=ajp13
worker.worker1.lbfactor=1
worker.worker1.local_worker=1
worker.worker1.sticky_session=0
worker.worker2.port=8009
worker.worker2.host=192.168.10.202
worker.worker2.type=ajp13
worker.worker2.lbfactor=1
worker.worker2.local_worker=0
worker.worker2.sticky_session=0
worker.router.type=lb
worker.router.balanced_workers=worker1,worker2
worker.router.local_worker_only=1
worker.status.type=status
:wq!
#####################################################
DONE
########################################
Just start all servers and check your apps
check the status by this url
http://192.168.10.100//jk_status
& check the apps by this url
http://192.168.10.100/apps
Login to your apps and bring down one tomcat similarly the other one also after bring back the first one again
Server.xml
###################################################################################
i am just posting it here for future myself & if it might help anybody else .
In this cluster i used two tomcat servers & one apache server.
Machines
Apache
IP 192.168.10.100
Tomcat
IP 192.168.10.201
IP 192.168.10.202
Packages that i have installed
###############################################
Tomcat:
tomcat6-servlet-2.5-api-6.0.26-27.fc14.noarch
tomcat6-jsp-2.1-api-6.0.26-27.fc14.noarch
tomcat6-el-2.1-api-6.0.26-27.fc14.noarch
tomcat6-lib-6.0.26-27.fc14.noarch
tomcat6-6.0.26-27.fc14.noarch
HTTPD
httpd-tools-2.2.17-1.fc14.i686
system-config-httpd-1.5.2-2.fc14.noarch
httpd-2.2.17-1.fc14.i686
and mod_jk
from this location
wget http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.31/i386/mod_jk-1.2.31-httpd-2.2.x.so
#################################################
Configuration Files
Tomcat
/etc/tomcat6/server.xml
/etc/tomcat6/context.xml
HTTPD
/etc/httpd/conf/httpd.conf
##################################################
Open the tomcat configuration file (server.xml )
And add the contents like this given below.
vim /etc/tomcat6/server.xml
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
redirectPort="8443" />
xmlValidation="false" xmlNamespaceAware="false">
suffix=".txt" pattern="common" resolveHosts="false"/>
notifyListenersOnReplication="true"/>
dropTime="3000"
frequency="500"
port="45564"/>
className="org.apache.catalina.tribes.transport.nio.NioReceiver"
maxThreads="6"
port="4000"
selectorTimeout="5000"/>
deployDir="${catalina.base}/webapps/"
watchDir="${catalina.base}/dir/"
watchEnabled="true"/>
:wq!
##################################################################################
In this case what are the apps comes under the webapps that all will be clustered in my case i had only my apps i have removed all default webapps.
Then scp the same file to second tomcat
and then change the followings jvmRoute=www1 to jvmRoute=www2 & watchEnabled="true" to watchEnabled="false"
watchEnabled field will check for the war files under this "${catalina.base}/dir/" location and if war file is uploaded it will deploy to the second server when you start the servers so in the second server don't forget to change the value from true to false.
(In my case in both the side i changed it false as i found some session failing error after the testing and i upload the war files manually)
##################################################
then next configuration file
vim /etc/tomcat6/context.xml
Add caption |
##################################################
scp to next host ...
Thats it.....
Now Apache configuration
##################################################
add the following on the conf file
vim /etc/httpd/conf/httpd.conf
LoadModule jk_module modules/mod_jk-1.2.31-httpd-2.2.x.so
JkWorkersFile conf/workers.properties
JkLogFile logs/jk.log
JkLogLevel debug
#
JkMount /* router
JkMount /jk_status status
:wq!
###################################################
Then create the file /etc/httpd/conf/workers.properties
vim /etc/httpd/conf/workers.properties
worker.list=router,status
worker.worker1.port=8009
worker.worker1.host=192.168.10.201
worker.worker1.type=ajp13
worker.worker1.lbfactor=1
worker.worker1.local_worker=1
worker.worker1.sticky_session=0
worker.worker2.port=8009
worker.worker2.host=192.168.10.202
worker.worker2.type=ajp13
worker.worker2.lbfactor=1
worker.worker2.local_worker=0
worker.worker2.sticky_session=0
worker.router.type=lb
worker.router.balanced_workers=worker1,worker2
worker.router.local_worker_only=1
worker.status.type=status
:wq!
#####################################################
DONE
########################################
Just start all servers and check your apps
check the status by this url
http://192.168.10.100//jk_status
& check the apps by this url
http://192.168.10.100/apps
Login to your apps and bring down one tomcat similarly the other one also after bring back the first one again
Server.xml
###################################################################################