Hi,
We have a server application using Lucene 4.5 and currently relies on shared storage or rsync to achieve primary/backup HA. Note that for now, only one instance will be writer at a time.
While checking on Infinspan 6.0 I found out that it is now providing a LuceneStoreConfigurationBuilder and I expect it to persist Lucene data files to local FS in a better way than SingleFileStoreConfigurationBuilder. I'm trying to mix info I find in online doc, JavaDoc, xml files and unit tests I find but did not manage to find a working configuration.
On top of Infinispan directory I'm also using Lucene TrackingIndexWriter, SearcherManager and ControlledRealTimeReopenThread but doubt it relates to my problems with LuceneStrore.
When I start primary node, a Infinispan-IndexStore dir is created but always stays empty, also Infinispan-SingleFileStore contains index.<name>.meta.dat. Rebuild of index starts pulling data from DB but nothing is ever written to IndexStore.
Once I start backup node, index.<name>.meta.dat is replicated but node then fails with file not found because nothing was replicated to IndexStore. See stack trace at the end of this post.
Switching to using SingleFileStore for data is a bit better as data is created to backup node, but I expect performance to be quite low as our indexes can reach 20GB or more.
Can someone share a working cluster configuration with persistent storage and eviction (to save RAM) for Infinispan 6.0 ?
Thank you!
--
See sample source below for my configuration. Note that I don't have any customization of jgroups, I let defaults from what is bundled with infinispan distribution.
Code:
public void setupGlobalConfiguration(String clusterName) {
GlobalConfigurationChildBuilder cfg = GlobalConfigurationBuilder.defaultClusteredBuilder().clusteredDefault();
cfg.globalJmxStatistics()
.enable()
.cacheManagerName("Lucene")
.allowDuplicateDomains(Boolean.TRUE)
.transport()
.clusterName(clusterName)
.distributedSyncTimeout(50000)
.shutdown()
.hookBehavior(ShutdownHookBehavior.DONT_REGISTER);
manager = new DefaultCacheManager(cfg.build());
}
public Directory getDirectory(String indexName) {
//Metadata configuration
ConfigurationBuilder
configuration = getBaseConfig();
configuration
.persistence()
.passivation(false)
.addStore(SingleFileStoreConfigurationBuilder.class)
.shared(true)
.fetchPersistentState(true)
.clustering()
.cacheMode(CacheMode.REPL_SYNC)
.sync().replTimeout(25000)
.stateTransfer()
.fetchInMemoryState(true)
.timeout(30000)
;
manager.defineConfiguration(indexName + ".meta", configuration.build());
Cache<?, ?> metadataCache = manager.getCache(indexName + ".meta");
//Data configuration
configuration = getBaseConfig();
configuration
.eviction()
.maxEntries(-1)
.strategy(EvictionStrategy.NONE)
.expiration()
.lifespan(-1)
.persistence()
.passivation(false)
.addStore(LuceneStoreConfigurationBuilder.class)
.autoChunkSize(110)
.shared(true)
.fetchPersistentState(true)
.clustering()
.cacheMode(CacheMode.REPL_SYNC)
.sync().replTimeout(25000)
.stateTransfer()
.fetchInMemoryState(true)
.timeout(30000)
;
manager.defineConfiguration(indexName + ".data", configuration.build());
Cache<?, ?> chunksCache = manager.getCache(indexName + ".data");
//Lock configuration
configuration = getBaseConfig();
configuration
.clustering()
.cacheMode(CacheMode.REPL_SYNC)
.sync().replTimeout(25000)
.stateTransfer()
.fetchInMemoryState(true)
.timeout(30000)
;
manager.defineConfiguration(indexName + ".locks", configuration.build());
Cache<?, ?> distLocksCache = manager.getCache(indexName + ".locks");
Directory directory = DirectoryBuilder
.newDirectoryInstance(metadataCache, chunksCache, distLocksCache, indexName)
.create();
return directory;
}
private ConfigurationBuilder getBaseConfig() {
ConfigurationBuilder configuration = new ConfigurationBuilder();
configuration
.locking()
.lockAcquisitionTimeout(20000)
.writeSkewCheck(false)
.concurrencyLevel(500)
.useLockStriping(false)
.transaction()
.transactionMode(TransactionMode.NON_TRANSACTIONAL)
.invocationBatching().disable()
.clustering()
.sync()
.replTimeout(20000)
.clustering()
.cacheMode(CacheMode.REPL_SYNC)
.stateTransfer()
.fetchInMemoryState(true)
.timeout(480000)
.eviction()
.maxEntries(-1)
.strategy(EvictionStrategy.NONE)
.expiration()
.maxIdle(-1)
;
return configuration;
}
Code:
...
Caused by: java.io.FileNotFoundException: Q:\build\dist\server\Infinispan-IndexStore\index.contact\_50.si (The system cannot find the path specified)
at java.io.RandomAccessFile.open(Native Method)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:233)
at org.apache.lucene.store.MMapDirectory.openInput(MMapDirectory.java:193)
at org.infinispan.lucene.cachestore.DirectoryV4Adaptor.openInput(DirectoryV4Adaptor.java:43)
at org.infinispan.lucene.cachestore.DirectoryLoaderAdaptor.loadIntern(DirectoryLoaderAdaptor.java:245)
at org.infinispan.lucene.cachestore.DirectoryLoaderAdaptor.access$300(DirectoryLoaderAdaptor.java:32)
at org.infinispan.lucene.cachestore.DirectoryLoaderAdaptor$LoadVisitor.visit(DirectoryLoaderAdaptor.java:297)
at org.infinispan.lucene.ChunkCacheKey.accept(ChunkCacheKey.java:71)
at org.infinispan.lucene.cachestore.DirectoryLoaderAdaptor.load(DirectoryLoaderAdaptor.java:186)
... 53 more