Hibernate Search in a Clustered Configuration?

2019-03-27 14:20发布

问题:

I have a Java web app that I'm developing, using JBoss Seam as the application framework. I'd like to take advantage of Hibernate Search to provide entity searching capabilities. The integration has gone fine, and I'm getting closer to deployment. The setup for the app in production will be:

  • 2 (or more) Tomcat app servers, load balanced
  • PostgreSQL database on the backend

My question is, how can I configure Hibernate Search so that the local Lucene indices are updated on App Server #2 when an entity is persisted on App Server #1, and vice versa? Does Hibernate Search have any sort of clustered-configuration support? The setup would have to be somewhat master-master since the persist could occur on either of the load-balanced app servers.

Does anyone have any recommendations on how to tackle this? Thanks for your help in advance!

回答1:

As describe in the reference documentation there are several back end types:

  • Lucene for non-clustered and
  • JMS or JGroups for clustered environments (sections 3.6. / 3.7), see this nice illustration from the docs:

There might be a way to use Terracotta, at least this post gives pointers in this direction (I don't know if it works well or even at all).