How to set Hibernate Lucene index to be pointed to shared location.(so no index generated in local server)

二次信任 提交于 2019-12-11 18:49:35

问题


In my application I am going to implement hibernate lucene. My application will be deployed in clustered environment.

Now, I am not able to find out how, I can point out the location of all the lucene index to a shared location. So it can be accessed through the network.


回答1:


You can, but it's not as simple as having a shared directory: two instances of your application cannot access the same index files simultaneously.

Thus, the preferred solution is generally to:

  1. Have only one "master" node access a "master" copy of the index, and have all other nodes send "write requests" to this "master" node.
  2. Periodically copy the "master" copy of the index to "slave" nodes, so that they can read it, even though their copy will always be slightly out of date.

Hibernate Search provides implementations for both mechanisms:

  1. The master/slave architecture is implemented thanks to a JMS backend or a JGroups backend. Note that the JMS backend is noticeably less buggy. Also note that you will have to configure JMS or JGroups yourself, and that may require some expertise too.
  2. The copying is implemented thanks to the filesystem-master and filesystem-slave directory providers.

So, that's a bit complex.

Another option, perhaps easier, is to use the Elasticsearch integration, moving the index to a remote cluster. It's simpler to use, but has some rough edges as it's still experimental.

We plan to bring first-class support for the Elasticsearch integration in the next version of Hibernate Search, version 6.



来源:https://stackoverflow.com/questions/54759834/how-to-set-hibernate-lucene-index-to-be-pointed-to-shared-location-so-no-index

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