5 Replies Latest reply on Jan 24, 2014 4:14 PM by gabfssilva

    Infinispan 6 on JBoss AS 7.2 final not replicating when start a new node

    gabfssilva

      Hi everyone,

       

      I'm trying to make Infinispan replicate a persistent cache, but it doesn't work very well.

      Here is my conf: (i'm not using Syntax Highlighting 'cause it's not working)

       

      <replicated-cache name="mysql-cache" mode="SYNC" remote-timeout="4000" start="EAGER">

                          <eviction max-entries="1000" strategy="LIRS"/>

                          <expiration max-idle="-1" lifespan="-1"/>

                  <string-keyed-jdbc-store datasource="java:jboss/datasources/MySQLCache" passivation="false" purge="false" preload="true" >

                              <string-keyed-table prefix="stringbased">

                                  <id-column name="id" type="VARCHAR(200)"/>

                                  <data-column name="value" type="VARCHAR(200)"/>

                              </string-keyed-table>

                          </string-keyed-jdbc-store>

                      </replicated-cache>

       

      My scenario is:

       

      I start two nodes in a cluster. Then, add 50 registers in cache. That works great. Well... I stop one node, add another 50 registers, so I turn this one up again and start-up the synchronization, after it ends, the node has only 97 registers, while the other one has 100 registers.

      I already tested it without cache-store and it works fine. It seems like a jdbc-stored issue.

       

      Well, I'm waiting for an answer.

      Thank you in advance!

        • 1. Re: Infinispan 6 on JBoss AS 7.2 final not replicating when starting node
          wdfink

          You should add the attribute shared=true to the string-keyed-jdbc-store element. Notice you have to do itfor all cluster members!

          This configure your jdbc store to be aware that there are multiple instances.

          • 2. Re: Infinispan 6 on JBoss AS 7.2 final not replicating when starting node
            gabfssilva

            They are two different nodes with a local database in each node. The shared attribute is used when the two nodes are using the same database. Not the case. But, thanks for answering. Is there anything that I could do to solve this problem?

            • 3. Re: Infinispan 6 on JBoss AS 7.2 final not replicating when starting node
              gabfssilva

              Well, when I increase max-entries of <eviction/> it works! But, I have no idea why it could happen. It seems like eviction has something to do with the replication issue. Is there a explanation for this?

               

              Thanks in advance again.

               

              Edited:

               

              Well, I found out that the fetch-state should be true if you want Infinispan to fetch data from local store to replicate to the others clusters. Setting this prop as true everything works. That's why when I did set high max-entries it worked. Because Infinispan replicated data from memory cache, not from the local store.

              • 4. Re: Infinispan 6 on JBoss AS 7.2 final not replicating when starting node
                wdfink

                I did not understand why you have two local datasources and a clustered cache. I suppose in that case you will have different results depending on what node is started.

                So I don't understand the sense behind.

                • 5. Re: Infinispan 6 on JBoss AS 7.2 final not replicating when starting node
                  gabfssilva

                  That's simple: I have two machines. I need to address high availability, so, I cannot have only one shared database. Every one will have its own local cache store. I tested it in several ways, if I use a low max-entries on eviction, I lose data when Infinispan replicate the stored cache to a new node. I mean, if I insert 100 new registers, when I add a new node only 94 registers are replicated to it. If I try to use with no eviction (max-entries="-1") it worked fine, but, I cannot have all data on memory or else I'd get an OutOfMemoryError. I tried to use Infinispan 5.3 and it did not happen, everything worked fine. Even using low max-entries. (what makes more sense).