Dear List,

I am having a Tomcat7 cluster of in-memory session replication.

Tomcat-A - 192.168.1.100
Tomcat-B - 192.168.1.101

I have simple application which does the login before navigating to the
pages. I have apache configured with mod_jk to handle sticky sessions.

when I am accessing the url , http://www.example.com the session is getting
established in one of the Tomcat server, suppose it established in
Tomcat-B. I starts navigating the pages after login.

Now I stopped Tomcat-B, in this can my session continues in Tomcat-A & it's
doesn't ask me for relogin to upon clicking in any links.

Problem starts when I try to starts Tomcat-B, when it's completely starts &
try to navigating any link on the same session , it's starts asking for
relogin.


Tomcat-B --> Tomcat-A , Tomcat-B Stops , no relogin. Tomcat-B  starts ,
relogin

Tomcat-A --> Tomcat-B , Tomcat-A Stops , no relogin. Tomcat-A  starts ,
relogin

Below is my server.xml, context.xml, web.xml, workers.properties &
httpd.conf .


Server.xml:
<Engine name="Catalina" defaultHost="localhost" jvmRoute="app1"> / <Engine
name="Catalina" defaultHost="localhost" jvmRoute="app2">

<alias>www.example.com</alias>
      </Host>
    <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
              channelSendOptions="8">
          <Manager className="org.apache.catalina.ha.session.DeltaManager"
                   expireSessionsOnShutdown="false"
           useDirtyFlag="true"
                   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"/>
               <Receiver
className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                         address="auto"
                         port="4000"
                         autoBind="100"
                         selectorTimeout="5000"
                         maxThreads="6"/>
               <Sender
className="org.apache.catalina.tribes.transport.ReplicationTransmitter"
replicationMode="pooled" ackTimeout="15000" waitForAck="true">
                   <Transport
className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"
timeout="30000"/>
               </Sender>
               <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=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.html;.*\.css;.*\.txt;"/>
                <Valve
className="org.apache.catalina.ha.session.JvmRouteBinderValve"
enabled="true" sessionIdAttribute="takeoverSessionid"/>

                <ClusterListener
className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
                <ClusterListener
className="org.apache.catalina.ha.session.ClusterSessionListener"/>
         </Cluster>


web.xml

<distributable/>
</web-app>


context.xml
<Context distributable="true">

workers.properties
worker.list=loadbalancer,status

#setup app1
worker.app1.port=8009
worker.app1.host=192.168.1.100
worker.app1.type=ajp13
worker.app1.lbfactor=50

#setup app2
worker.app2.port=8009
worker.app2.host=192.168.1.101
worker.app2.type=ajp13
worker.app2.lbfactor=50

#setup the load-balancer
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=app1,app2
worker.loadbalancer.sticky_session=True
worker.loadbalancer.sticky_session_force=True

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

httpd.conf

JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogStampFormat "[%b %d %Y - %H:%M:%S] "
JkRequestLogFormat "%w %V %T"
JkLogLevel info
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

<VirtualHost *>
  ServerAdmin exam...@example.com
  ServerAlias www.example.com
  JkMount /* loadbalancer
  JkMount /status/* status
</VirtualHost>

Reply via email to