-
1. Re: Nodes lost after server restart
adam.mccormick Jul 19, 2014 11:46 PM (in response to itc-edo)1 of 1 people found this helpfulYou need to add some cache configurations to the
storage
section, which you don't have. Without it Modeshape uses a default Infinispan configuration which is an in-memory cache. Just having an infinispan.xml file on the classpath won't do.Add the following to your repository config json:
"storage" : { "cacheName" : "iris_repository", "cacheConfiguration" : "infinispan.xml", "transactionManagerLookup" = "org.infinispan.transaction.lookup.GenericTransactionManagerLookup", "binaryStorage" : { "type" : "file", "directory" : "/home/myuser/repoFolder", "minimumBinarySizeInBytes" : 40 } },
The above configures Modeshape to use the cache
iris_repository
(from thecacheName
property) from the Infinispan configuration pointed to by thecacheConfiguration
property.Here's an example infinispan.xml which uses the file system cache store to persist to disk. Note the property "location" which is where the store will write to. I put it in a directory beside where you store your binaries (which is where I think you may have the confusion if you though that section was storing repository data. It's not. The
binaryStorage
section defines where property values will be stored if they are over the size configured, in your case > 40 bytes. This doesn't actually store any node/property information).<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:infinispan:config:5.1 http://www.infinispan.org/schemas/infinispan-config-5.1.xsd" xmlns="urn:infinispan:config:5.1"> <global> </global> <default> </default> <namedCache name="iris_cache"> <transaction transactionManagerLookupClass="org.infinispan.transaction.lookup.GenericTransactionManagerLookup" transactionMode="TRANSACTIONAL" lockingMode="PESSIMISTIC"/> <loaders passivation="false" shared="false" preload="false"> <loader class="org.infinispan.loaders.file.FileCacheStore" fetchPersistentState="false" purgeOnStartup="false"> <properties> <!-- location where to store the data. --> <property name="location" value="/home/myuser/repoData"/> </properties> <async enabled="true" flushLockTimeout="15000" threadPoolSize="5"/> </loader> </loaders> </namedCache> </infinispan>
Checkout the docs for more info. The above Infinispan config is basically the one from: ModeShape in Java applications - ModeShape 3 - Project Documentation Editor
Hope this helps
-
2. Re: Nodes lost after server restart
itc-edo Jul 21, 2014 7:28 AM (in response to adam.mccormick)Hello Adam,
thank you for your helpful answer.
I've already find out this, via try and error.
ModeShape have good documentation, but in this case it is really rare.
From my point of view, the documentation should state explicitly, that the data are lost form the REPO, when you do not use an infinspan config with "location"...
This is the main feature of an repository, to find the data again, even after restart
Maybe it should be titled as serializer, and not 'only' as cache.
Thank you very much, for the example.