Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

Ehcache replication configuration in Tomcat Cluster

$
0
0

I have the following ehcache configs for 3 different tomcat instances.

My assumption is, that in each ehcache, we should define the instance as a provider and a listener.

I tried different combinations, for example defining all the tree instances as provider in each ehcache and only one listener(current instance). None of these configs have worked for me. Below you see the first ehcache, the second and third ehcache have only the port number 40002 and 40003 instead of 4001.

Another issue that I couldn't find any where, is the name of cache, should it be like the full package address of the object that needed to be replicated? (I defined it so). Should we define all of our caches there? and if yes, should we also add these names to the RMI addresses?

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="ehcache.xsd">

 <cache name="com.service.scheduler.Activity"
           maxElementsInMemory="30"
           maxElementsOnDisk="100000"
           eternal="true"
           overflowToDisk="true"
           diskPersistent="true"
           diskSpoolBufferSizeMB="20"
           timeToIdleSeconds="50"
           timeToLiveSeconds="5"
           memoryStoreEvictionPolicy="LFU">


            <bootstrapCacheLoaderFactory class = "net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory" properties = "bootstrapAsynchronously=false, maximumChunkSizeBytes=5000000"/>

            <cacheEventListenerFactory class = "net.sf.ehcache.distribution.RMICacheReplicatorFactory" properties="replicateAsynchronously=true, asynchronousReplicationIntervalMillis=100"/>

           </cache>

         <cache name="com.data.interfaces.feature.Feature"
           maxElementsInMemory="30"
           maxElementsOnDisk="100000"
           eternal="true"
           overflowToDisk="true"
           diskPersistent="true"
           diskSpoolBufferSizeMB="20"
           timeToIdleSeconds="50"
           timeToLiveSeconds="5"
           memoryStoreEvictionPolicy="LFU">


            <bootstrapCacheLoaderFactory class = "net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory" properties = "bootstrapAsynchronously=false, maximumChunkSizeBytes=5000000"/>

            <cacheEventListenerFactory class = "net.sf.ehcache.distribution.RMICacheReplicatorFactory" properties="replicateAsynchronously=true, asynchronousReplicationIntervalMillis=100"/>

           </cache> 

        <cache name="com.data.interfaces.classification.ClassificationSystem"
           maxElementsInMemory="30"
           maxElementsOnDisk="100000"
           eternal="true"
           overflowToDisk="true"
           diskPersistent="true"
           diskSpoolBufferSizeMB="20"
           timeToIdleSeconds="50"
           timeToLiveSeconds="5"
           memoryStoreEvictionPolicy="LFU">


            <bootstrapCacheLoaderFactory class = "net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory" properties = "bootstrapAsynchronously=false, maximumChunkSizeBytes=5000000"/>

            <cacheEventListenerFactory class = "net.sf.ehcache.distribution.RMICacheReplicatorFactory" properties="replicateAsynchronously=true, asynchronousReplicationIntervalMillis=100"/>

           </cache>  


 <cacheManagerPeerProviderFactory class = "net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory" properties = "peerDiscovery=manual, rmiUrls=//localhost:40001/activityCache|//localhost:40001/featureCache|//localhost:40001/classificationCache"/>


<cacheManagerPeerListenerFactory class = "net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" properties = "hostName=localhost, port=40001, socketTimeoutMillis=2000"/>

</ehcache>

Here you can see the output of one of the instances:

   Information: valid
    ateJarFile(C:\DEV_ENV\Cluster_Server\worker1\apache-to
    mcat-7.0.56\webapps\solr\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Serv
    let Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
    Mrz 05, 2016 11:28:09 AM org.apache.solr.core.SolrCore getNewIndexDir
    Warnung: New index directory detected: old=null new=./solr/data1\index/
    Mrz 05, 2016 11:28:10 AM org.apache.solr.handler.XmlUpdateRequestHandler init
    Warnung: Using deprecated class: XmlUpdateRequestHandler -- replace with UpdateR
    equestHandler
    Mrz 05, 2016 11:28:10 AM org.apache.solr.core.SolrCore getNewIndexDir
    Warnung: New index directory detected: old=null new=./solr/data\index/
    Mrz 05, 2016 11:28:10 AM org.apache.solr.handler.XmlUpdateRequestHandler init
    Warnung: Using deprecated class: XmlUpdateRequestHandler -- replace with UpdateR
    equestHandler
    Mrz 05, 2016 11:28:10 AM org.apache.catalina.startup.HostConfig deployWAR
    Information: Deployment of web application archive C:\DEV_ENV\Cluster_Se
    rver\worker1\apache-tomcat-7.0.56\webapps\solr.war has finished in 1,300 ms
    Mrz 05, 2016 11:28:10 AM org.apache.coyote.AbstractProtocol start
    Information: Starting ProtocolHandler ["http-bio-8081"]
    Mrz 05, 2016 11:28:10 AM org.apache.coyote.AbstractProtocol start
    Information: Starting ProtocolHandler ["ajp-bio-8009"]
    Mrz 05, 2016 11:28:10 AM org.apache.catalina.startup.Catalina start
    Information: Server startup in 35993 ms
    Mrz 05, 2016 11:28:17 AM org.apache.catalina.ha.tcp.SimpleTcpCluster memberAdded

    Information: Replication member added:org.apache.catalina.tribes.membership.Stat
    icMember[tcp://localhost:4001,localhost,4001, alive=0, securePort=-1, UDP Port=-
    1, id={0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 }, payload={}, command={}, domain={
    116 101 115 116 45 100 111 109 97 ...(11)}, ]
    Mrz 05, 2016 11:28:17 AM org.apache.catalina.tribes.group.interceptors.TcpFailur
    eDetector performBasicCheck
    Information: Suspect member, confirmed alive.[org.apache.catalina.tribes.members
    hip.StaticMember[tcp://localhost:4001,localhost,4001, alive=0, securePort=-1, UD
    P Port=-1, id={0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 }, payload={}, command={},
    domain={116 101 115 116 45 100 111 109 97 ...(11)}, ]]
    Mrz 05, 2016 11:28:17 AM org.apache.catalina.ha.tcp.SimpleTcpCluster memberAdded

    Information: Replication member added:org.apache.catalina.tribes.membership.Memb
    erImpl[tcp://{127, 0, 0, 1}:4001,{127, 0, 0, 1},4001, alive=1030, securePort=-1,
     UDP Port=-1, id={85 60 85 88 38 -44 66 90 -74 38 -11 -87 97 123 23 -12 }, paylo
    ad={}, command={}, domain={116 101 115 116 45 100 111 109 97 ...(11)}, ]
    Mrz 05, 2016 11:29:15 AM org.apache.catalina.ha.tcp.SimpleTcpCluster memberAdded

    Information: Replication member added:org.apache.catalina.tribes.membership.Memb
    erImpl[tcp://{127, 0, 0, 1}:4002,{127, 0, 0, 1},4002, alive=1040, securePort=-1,
     UDP Port=-1, id={47 12 -18 -55 104 85 71 -77 -82 -68 -7 -21 99 124 54 122 }, pa
    yload={}, command={}, domain={116 101 115 116 45 100 111 109 97 ...(11)}, ]

And here another instance:

Mrz 05, 2016 11:28:52 AM org.apache.catalina.startup.HostConfig deployWAR
Information: Deployment of web application archive C:\DEV_ENV\Cluster_Se
rver\worker2\apache-tomcat-7.0.56\webapps\solr.war has finished in 1,340 ms
Mrz 05, 2016 11:28:52 AM org.apache.coyote.AbstractProtocol start
Information: Starting ProtocolHandler ["http-bio-8082"]
Mrz 05, 2016 11:28:52 AM org.apache.coyote.AbstractProtocol start
Information: Starting ProtocolHandler ["ajp-bio-8010"]
Mrz 05, 2016 11:28:52 AM org.apache.catalina.startup.Catalina start
Information: Server startup in 36252 ms
Mrz 05, 2016 11:28:54 AM org.apache.catalina.loader.WebappClassLoader findResour
ceInternal
Information: Illegal access: this web application instance has been stopped alre
ady.  Could not load ehcache-version.properties.  The eventual following stack t
race is caused by an error thrown for debugging purposes as well as to attempt t
o terminate the thread which caused the illegal access, and has no functional im
pact.
Mrz 05, 2016 11:29:15 AM org.apache.catalina.ha.tcp.SimpleTcpCluster memberAdded

Information: Replication member added:org.apache.catalina.tribes.membership.Memb
erImpl[tcp://{127, 0, 0, 1}:4002,{127, 0, 0, 1},4002, alive=1040, securePort=-1,
 UDP Port=-1, id={47 12 -18 -55 104 85 71 -77 -82 -68 -7 -21 99 124 54 122 }, pa
yload={}, command={}, domain={116 101 115 116 45 100 111 109 97 ...(11)}, ]

Here are also the definitions of caches and cahchSevices:

 <bean id="featureCache" parent="abstractOptionalCache">
    <property name="maxElementsInMemory" value="${cache.feature.maxMemoryElements}"/>
    <property name="maxElementsOnDisk" value="${cache.feature.maxDiskElements}"/> 
    <property name="overflowToDisk" value="${cache.feature.useDisk}"/>
  </bean>

  <bean id="featureCacheService" parent="abstractService" class="com.service.business.cache.impl.ehcache.EHcacheFeatureCacheService">
    <property name="cache"  ref="featureCache"/>
    <property name="enabled" value="${cache.feature.enable}"/>
  </bean> 

  <bean id="activityCache" parent="abstractMandatoryCache">
    <property name="cacheManager" ref="cacheManager"/>
    <property name="maxElementsInMemory" value="${cache.activity.maxMemoryElements}"/>
  </bean>

   <bean id="activityCacheService" parent="abstractService" class="com.service.business.cache.impl.ehcache.EHcacheActivityCacheService">
    <property name="cache"  ref="activityCache"/>
  </bean> 


  <bean id="classificationCache" parent="abstractOptionalCache">
    <property name="cacheManager" ref="cacheManager"/>
    <property name="maxElementsInMemory" value="${cache.classification.maxMemoryElements}"/>
    <property name="maxElementsOnDisk" value="${cache.classification.maxDiskElements}"/> 
    <property name="overflowToDisk" value="${cache.classification.useDisk}"/>
  </bean>

  <bean id="classificationCacheService" parent="abstractService" class="com.service.business.cache.impl.ehcache.EHcacheClassificationCacheService">
    <property name="cache"     ref="classificationCache" />
    <property name="enabled" value="${cache.classification.enable}"/>
  </bean>

I will provide more info upon your request.

Thank you in advance.


Viewing all articles
Browse latest Browse all 17268

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>