Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Implement a Dynamic Tomcat Cluster with Mod_Cluster-2 : Page 2


advertisement

Mod_Cluster Configuration in Apache Web Server

Add the following modules in your Apache Web Server to enable clustering and load balancing:

  1. mod_proxy_ajp
  2. mod_proxy
  3. mod_proxy_cluster
  4. mod_manager
  5. mod_advertise
  6. mod_slotmem

The Apache Web Server has an httpd.conf file. This file contains loading module, cluster, load balancer, host, and log format configuration details. The configuration data below needs to be added for enabling clustering and load balancing in the Apache Web Server. Also below is the required module for enabling clustering and load balancing.

Configuration data for load module


LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_ajp_module modules/mod_proxy_ajp.so LoadModule slotmem_module modules/mod_slotmem.so LoadModule manager_module modules/mod_manager.so LoadModule proxy_cluster_module modules/mod_proxy_cluster.so LoadModule advertise_module modules/mod_advertise.so

Configuration for mod_cluster and load balancer

# MOD_CLUSTER configuration details <IfModule manager_module> Listen *:9999 ManagerBalancerName paascluster <VirtualHost *:9999> <Directory />  : : : : :Order deny,allow  : : : : :Deny from none  : : : : :Allow from all </Directory> KeepAliveTimeout 300 MaxKeepAliveRequests 0 ServerAdvertise on http://localhost:9999 AdvertiseFrequency 5 <Location /mod_cluster_paas> SetHandler mod_cluster-manager Order deny,allow Deny from none Allow from all </Location> </VirtualHost> </IfModule>

After adding the above configuration in the httpd.conf file, you have to restart Apache Web Server. To verify the clustering and load balancing, follow these steps:

  1. Open a Web browser.
  2. Type this address: http://localhost:9999/mod_cluster_paas

If the details below appear in the browser, then the cluster and load balancer are enabled.

Dynamic Clustering in Tomcat

To enable clustering in Tomcat, add the following JAR in the lib folder:

Jar name: Mod_cluster.1.1.3.jar : This jar is provided by jboss Jar download URL : http://www.jboss.org/mod_cluster/downloads/1-1-3

Using the above JAR connects Apache Web Server with Tomcat Application Server via AJP.

Below is the Apache Application Server configuration for clustering and load balancing with Apache Web Server:

  1. Add the below listener entry on top of the server tag in Apache Application Server's server.xml file.

    <Listener className="org.jboss.modcluster.catalina.ModClusterListener" advertise="true" proxyList="localhost:9999"/>

  2. Enable AJP connector tag in the server.xml file.

    <Connector protocol="AJP/1.3" port="8669" redirectPort="8443"/>

  3. Add the jvmRoute name in the engine tag in server.xml. This name is useful for identifying the system in the cluster and gives a different name to each Tomcat application server.

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

  4. Add cluster and channel details to the engine tag in the server.xml file. This configuration is used for enabling different groups of clusters in Apache Web Server. The membership tag is used for setting the multicast IP for different groups of clusters based on multicast IP address.

    <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="6">
    <Manager className="org.apache.catalina.ha.session.BackupManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true" mapSendOptions="6"/>
    <Channel className="org.apache.catalina.tribes.group.GroupChannel">
    <Membership className="org.apache.catalina.tribes.membership.McastService" address="228.0.0.4" port="45564" frequency="500" dropTime="3000"/>
    <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver" address="auto" port="5000" selectorTimeout="100" maxThreads="6"/>
    <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
    <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
    </Sender>
    <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
    <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>
    <Interceptor className="org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor"/>
    </Channel>
    <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer" tempDir="/tmp/war-temp/" deployDir="/tmp/war-deploy/" watchDir="/tmp/war-listen/" watchEnabled="false"/>
    <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
    </Cluster>



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap