1 Reply Latest reply on Jan 30, 2013 10:04 AM by pferraro

    How to make replication of cache on particular Node in cluster ?

    hitesysony87

      I  have cluster of four Node N1 ,N2 ,N3 ,N4.

      Here N1 is master node and N2,N3,N4 are slave node.

      In my configuration i am using "distribution" of cache instead of "replication" .

      I have made property "owners=2 " to make cache replication  only on two node in cluster.

      Means when i put data in cache it will store only two node in cluster.

      I want to make data replicated on particular node which is configurable.

      Means when node N1 put data in cache it must be store on Node N1 and N2 only.

      If Node N3 put data in cache it must be N3 and N4 only.

      Here Cache may be for "HttpSession" or "Infinispan" Cache.

        • 1. Re: How to make replication of cache on particular Node in cluster ?
          pferraro

          Whe you use DIST mode, the data is only store on X nodes in your cluster (where X is the number of "owners"), but the data is available from *any* node.  If a node attempts to access a cache entry that is stored on another node, it will perform a remote lookup to retrieve the value.  Results from remote lookups will be cached on the local node for the duration (in ms) specified by the <distributed-cache l1-lifespan="..."/> attribute.

           

          The process for selecting the nodes on which a given cache entry will be stored is based on Infinispan's default consistent hash function.  Due to the nature of how a consistant hash works - you cannot take a randomly generated key (as is the case for HttpSession IDs) and map them to specific nodes.  Only if you have full control over the key generation itself can you create your own hash function that conforms to your mapping rules.

           

          Can I ask why you have such a requirement?  If your data needs to be backed up in such a rigid way, why not just use 2 separate clusters (N1, N2) + (N3, N4)?