1 Reply Latest reply: May 10, 2012 3:56 AM by Martin Gencur RSS

Lost in Infinispan

Laurent Vanzeune Newbie

Hello,

 

Trying to get up an running a distributed data grid with several nodes.I understood it was not possible to have a node with no caching so all nodes will be configured the same way. One of the nodes will load the data and put element per element in the custered cache. Data should be (evenly) distributed among the different nodes and cache entries should stay in memory (and only in memory) until programmatically removed.

 

This is how I configured the cache manager:

return new DefaultCacheManager(

GlobalConfigurationBuilder.defaultClusteredBuilder()

  .transport().addProperty("configurationFile", "jgroups.xml")

  .build(),

new ConfigurationBuilder()

  .clustering()

  .cacheMode(CacheMode.DIST_SYNC)

  .hash().numOwners(1)

  .build()

);

 

When running I can see:

- The cluster forms correctly.

- All entries are slowly added to only one of the node.

 

Do I miss something?

 

Thanks for helping.

 

Regards.

  • 1. Re: Lost in Infinispan
    Martin Gencur Novice

    When you set .hash().numOwners(1), it means that data will be stored only to 1 node. When using "distributed" mode, it makes sense to use at least 2 owners (depending on how many nodes you have and how manty copies of each entry you want - to ensure fault tolerance).

     

    If you'd like to store entries to all nodes, use CacheMode.REPL_SYNC. Then you don't have to specify numOwners as all the nodes will be owners.