Hibernate Search in a Clustered Configuration?
Asked Answered
R

1

7

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!

Recalescence answered 7/10, 2011 at 20:18 Comment(0)
E
6

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:

enter image description here

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).

Eulalie answered 7/10, 2011 at 20:45 Comment(2)
So, are there ways to leverage JMS or JGroups when running Tomcat? I know JMS is provided with JBoss out of the box, but we will be deploying the application under Tomcat.Recalescence
@Shadowman: Right, as Tomcat is just a servlet container it comes without a JMS broker. So you have to care about this issue yourself. When using Spring you can quite easily embed e.g. an ActiveMQ broker inside you app / war file. Or make the broker an extra structural compontent which can be integrated with Tomcat using JNDI easily as well. For JGroups you just need a proper configuration (and the jar's) (see ref guide again).Eulalie

© 2022 - 2024 — McMap. All rights reserved.