To the Hibernate Search team,
I have sucessfully implemented Hibernate Search in a Tomcat/Spring/Hibernate environment.
We have decided to upgrade our application server to JBOSS as it supports the full J2EE stack and this is where I came across the JMS/Master Slave config for Hibernate Search
In order to create a working prototype I have ported 3 instances of the webapp from Tomcat to the JBOSS deployer. I have configured 2 instances as slaves and one as the master.
My slave hibernate config is as follows
1. Ignore the second level stuff for Memchached as its disabled
2. The two instances each have their own index directory "slave1" and "slave2". For this example all directories are on the same machine.
Code:
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
# Needed by Hibernate3 Maven Plugin defined in pom.xml
hibernate.connection.username=####
hibernate.connection.password=####
hibernate.connection.url=jdbc:mysql://localhost/tantalus?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.cache.use_second_level_cache=false
hibernate.cache.provider_class=com.googlecode.hibernate.memcached.MemcachedCacheProvider
hibernate.generate_statistics true
hibernate.cache.use_structured_entries true
hibernate.memcached.servers=################:11211
hibernate.search.default.sourceBase=C://java//indexes//shared
# local copy location #
hibernate.search.default.indexBase=C://java//indexes//slave1
# refresh every 5 minutes
hibernate.search.default.refresh=300
# appropriate directory provider
hibernate.search.directory_provider org.hibernate.search.store.FSSlaveDirectoryProvider
## Backend configuration
hibernate.search.worker.backend jms
hibernate.search.worker.jms.connection_factory java:/ConnectionFactory
hibernate.search.worker.jms.queue queue/hibernatesearch
##java specific settings
java.naming.provider.url jnp://localhost:1099
My Master configuration is as such. there may be some nefarious entries owing to playing aorund trying to get it to work
Code:
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
# Needed by Hibernate3 Maven Plugin defined in pom.xml
hibernate.connection.username=#####
hibernate.connection.password=#####
hibernate.connection.url=jdbc:mysql://localhost/tantalus?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8
hibernate.connection.driver_class=com.mysql.jdbc.Driver
### master configuration
## DirectoryProvider # (remote) master location where information is copied to
hibernate.search.default.sourceBase=C://java//indexes//shared
# local master location
hibernate.search.default.indexBase=C://java//indexes//master
# refresh every 2 minutes
hibernate.search.default.refresh=120
# appropriate directory provider
hibernate.search.directory_provider org.hibernate.search.store.FSMasterDirectoryProvider
hibernate.cache.use_second_level_cache=false
hibernate.cache.provider_class=com.googlecode.hibernate.memcached.MemcachedCacheProvider
hibernate.generate_statistics true
hibernate.cache.use_structured_entries true
hibernate.memcached.servers=################:11211
##java specific settings
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jnp.interfaces
java.naming.provider.url jnp://localhost:1099
The master also contains the MDBSearchController specified in the examples as well as the events specifed in the config guide for the session factory.
I have specified the queue in JBOSS
Code:
<mbean code="org.jboss.mq.server.jmx.Queue"
name="jboss.mq.destination:service=Queue,name=hibernatesearch">
<attribute name="JNDIName">queue/hibernatesearch</attribute>
<depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
<depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>
<attribute name="SecurityConf">
<security>
<role name="guest" read="true" write="true" create="true"/>
<role name="publisher" read="true" write="true" create="true"/>
<role name="durpublisher" read="true" write="true" create="true"/>
</security>
</attribute>
</mbean>
The results I get at this stage are as follows
1) The slaves correctly do not update their own indexes, but send a message to the queue, I can see this happening in the JMX consol so I know the messages are being sent.
2) The Master updates its own index but it does not seem to be fulfilling its role as a message consumer as
a) Its not processing the messages sent to the queue
b) Its not initiating the fie system replication and copy of the index
What is eluding me at this point is what else is needed to initate points a) and b)?
If you need any other config let me know. I am pretty keen to get this as a working prototype so I can do some stress and performance testing.
Would anybody be able to shed any light or provide any avenues of investigation as to why this may not be working.
Bearing in mind I am intermediate Spring/Hibernate and pretty new to JBOSS/JMS etc
Thanks