Infinispan distributed cluster with shared index

孤人 提交于 2019-12-21 23:27:12

问题


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:


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.



来源:https://stackoverflow.com/questions/23544160/infinispan-distributed-cluster-with-shared-index

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!