Infinispan distributed cluster with shared index

2019-04-16 12:06发布

Does anybody have a working example of how to configure a cluster of nodes to share an index using the infinispan directory provider? All the documentation on Infinispan (the documentation is seriously lacking btw) implies that it should be as easy as having some properties set but no matter how I try I cannot get it to work. The nodes in the cluster find eachother fine and I can do get operations on one node and get object that were put on another. But as soon as I do queries (use the index) it just starts to fail.

My infinispan config:

<global>
        <transport clusterName="SomeCluster">
            <properties>
                <property name="configurationFile" value="jgroups-udp.xml" />
            </properties>
        </transport>
    </global>
    <namedCache name="access">
        <clustering mode="distribution" />
        <indexing enabled="true" indexLocalOnly="true">
            <properties>
                <property name="default.directory_provider" value="infinispan"/>
                <property name="default.worker.backend" value="jgroups"/>
            </properties>
        </indexing>
    </namedCache>

I have not found one example/tutorial which covers a distributed cache with a shared index, and I consider my google-fu to be great. I have asked on the infinispan community forum but havent gotten any replies there.

The errors I get are all related to the fact that only one node can be able to write to the index (the master node) but the config above, which according some the documentation on Hibernet Search should make one node a master node, does nothing as far as I can se.

Edit:Im using Infinispan 6.0.2.Final

1条回答
看我几分像从前
2楼-- · 2019-04-16 12:48

Rather than JGroups backend I'd use InfinispanIndexManager - this manager already provides its own backend.

<indexing enabled="true" indexLocalOnly="true">
   <properties>
      <property name="default.indexmanager" value="org.infinispan.query.indexmanager.InfinispanIndexManager" />
      <property name="default.exclusive_index_use" value="false" />
      <property name="default.metadata_cachename" value="lucene_metadata_repl" />
      <property name="default.data_cachename" value="lucene_data_dist" />
      <property name="default.locking_cachename" value="lucene_locking_repl" />
      <property name="lucene_version" value="LUCENE_36" />
   </properties>
</indexing>

Now, configure all the caches to be clustered (distributed or replicated). Without specifying the cache configuration this way, the three caches are created using the default cache configuration - which is by default non-clustered. I am not sure about the exclusive_index_use, though, maybe it's not necessary.

I agree that Infinispan documentation could be much better, usually I have to fallback to investigating source code. For examples of indexing configuration, you can look into the infinispan-query module/src/test/resources.

查看更多
登录 后发表回答