Tomcat Cluster
Configuration….
Download tomcat from below link.
Create directory for tomcat cluster instances
called “T_Cluster”.
Under directory “T_Cluster” create three directories for three tomcat instances and
extract downloaded tomcat into each instance directory.
Edit Server.xml
file for instance configuration make below changes in file.
1.
Change Default shutdown Port.
<Server port="8007" shutdown="SHUTDOWN">
2.
Change Default AJP Port.
<Connector port="8011"
protocol="AJP/1.3" redirectPort="8443" />
3.
Add JvmRoute name.
<Engine name="Catalina"
defaultHost="localhost" jvmRoute="tomcat2">
4.
Cluster Configuration make sure you add below lines below cluster
configuration will be same for other instances.
<Cluster
className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
channelSendOptions="8">
<Manager
className="org.apache.catalina.ha.session.DeltaManager"
expireSessionsOnShutdown="false"
notifyListenersOnReplication="true"/>
<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"/>
<Sender
className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
<Transport
className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
</Sender>
<Receiver
className="org.apache.catalina.tribes.transport.nio.NioReceiver"
address="auto"
port="4001"
autoBind="100"
selectorTimeout="5000"
maxThreads="6"/>
<Interceptor
className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
<Interceptor
className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>
</Channel>
<Valve
className="org.apache.catalina.ha.tcp.ReplicationValve"
filter=""/>
<Valve
className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>
<ClusterListener
className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
<ClusterListener
className="org.apache.catalina.ha.session.ClusterSessionListener"/>
</Cluster>
Cluster
Configuration End’s here.
Make above changes in
other two instances.
In the deployed
application add “<distributable/>” Tag in
web.xml file for session replication.
Now open CMD and start
tomcat.
C:\>cd T_Cluster\Node-1\bin
C:\T_Cluster\Node-1\bin>startup.bat
Start all three tomcat
instances.
Restart Apache server…
Testing…
Access apache server URL
with configured port.
Check tomcat individual
URL’s.
No comments:
Post a Comment