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(
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.
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.
|Retrieving data ...|