-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: [Hibernate Search] question about SLAVE/MASTER config
PostPosted: Thu Oct 25, 2007 4:53 pm 
Newbie

Joined: Fri Jun 15, 2007 11:37 am
Posts: 7
Hello, I'm using Hibernate Search 3.0 GA.

Due to the complexity of our architecture we have to rebuild the lucene indexes every night.

The indexes are built by a standalone java app, on a very fast machine.

Now we want to update all the nodes in our cluster (for the web app using the indexes) with a local copy of the latest index. How can we do that?

In other word we have 3 machines, one is the master rebuilding everynight the master index, and 2 machines are web app servers clustered with a copy of the master index. We do not need JMS since nobody update the master index (except the standalone app scheduled to run every night)

I tried to setup my 2 nodes like this:
<!-- Hibernate Search -->
<property name="hibernate.search.default.directory_provider">org.hibernate.search.store.FSSlaveDirectoryProvider</property>
<property name="hibernate.search.default.indexBase">C:\Projects\index</property>
<property name="hibernate.search.default.sourceBase">\\masterServer\lucene\masterindex</property>
<property name="hibernate.search.default.refresh">1800</property>


But I get the following exception:

org.hibernate.HibernateException: Unable to initialize: ContractAltId
at org.hibernate.search.store.DirectoryProviderFactory.createDirectoryProvider(DirectoryProviderFactory.java:147)
at org.hibernate.search.store.DirectoryProviderFactory.createDirectoryProviders(DirectoryProviderFactory.java:75)
at org.hibernate.search.impl.SearchFactoryImpl.initDocumentBuilders(SearchFactoryImpl.java:260)
at org.hibernate.search.impl.SearchFactoryImpl.<init>(SearchFactoryImpl.java:94)
at org.hibernate.search.impl.SearchFactoryImpl.getSearchFactory(SearchFactoryImpl.java:172)
Truncated. see log file for complete stacktrace
java.lang.IllegalStateException: No current marker in source directory
at org.hibernate.search.store.FSSlaveDirectoryProvider.initialize(FSSlaveDirectoryProvider.java:56)
at org.hibernate.search.store.DirectoryProviderFactory.createDirectoryProvider(DirectoryProviderFactory.java:144)
at org.hibernate.search.store.DirectoryProviderFactory.createDirectoryProviders(DirectoryProviderFactory.java:75)
at org.hibernate.search.impl.SearchFactoryImpl.initDocumentBuilders(SearchFactoryImpl.java:260)
at org.hibernate.search.impl.SearchFactoryImpl.<init>(SearchFactoryImpl.java:94)

Any suggestion on how to deploy properly this configuration?

Thanks!
-Christophe


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 26, 2007 11:52 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I need to document that some day.
To avoid copying a locked or inconsistent directory, the master keeps 2 copies of the index. One is available for the slaves, the second is available for the master to update it. When a master update is done, the 2 directories switch.

So you basically have
masterDir/1 (directory)
masterDir(2 (directory)

To differentiate an active directory (for slave copy) from the other one, a marker file is read.

masterDir/current1 if the directory 1 is the available one
masterDir/current2 if the diectory 2 is the available one

So you will need to follow this pattern for your master.

Note that you probably also add hibernate.search.indexing_strategy manual to avoid the event system to work, since your slaves are read only

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 09, 2007 1:46 am 
Newbie

Joined: Fri Jun 15, 2007 11:37 am
Posts: 7
Thanks Emmanuel, that really helped me to understand how the master/slave config works. That's really clever.


Top
 Profile  
 
 Post subject: question about SLAVE/MASTER config
PostPosted: Wed Oct 01, 2008 10:59 am 
Newbie

Joined: Wed Oct 01, 2008 8:39 am
Posts: 4
I have the similar problem on the slave side. My configuration file on the slave side is as follow:
Code:
<!-- This is for JMS indexing -->
<property name="hibernate.search.default.sourceBase" value="c:/temp/lucene/mastercopy" />
<property name="hibernate.search.default.indexBase" value="c:/temp/lucene/prod2" />
<property name="hibernate.search.default.refresh" value="300" />
<property name="hibernate.search.default.directory_provider" value="org.hibernate.search.store.FSSlaveDirectoryProvider" />
<property name="hibernate.search.worker.backend" value="jms" />
<property name="hibernate.search.worker.jms.connection_factory" value="java:/ConnectionFactory" />
<property name="hibernate.search.worker.jms.queue" value="queue/HibernateSearch" />
<property name="hibernate.search.worker.jndi.url" value="jnp://localhost:1099" />
<property name="hibernate.search.worker.execution" value="async" />
<property name="hibernate.search.worker.thread_pool.size" value="2" />
<property name="hibernate.search.worker.buffer_queue.max" value="50" />
<property name="hibernate.search.indexing_strategy" value="manual" />


I assume the Create, Update, & Delete operations on the slave side with JPA/Entity Manager will register index creation to the master via JMS.

But running the slave part with J2SE triggers the exception.
Code:
Caused by: java.lang.IllegalStateException: No current marker in source directory
   at org.hibernate.search.store.FSSlaveDirectoryProvider.initialize(FSSlaveDirectoryProvider.java:56)
   at org.hibernate.search.store.DirectoryProviderFactory.createDirectoryProvider(DirectoryProviderFactory.java:144)
   ... 17 more


Could you please tell me what is wrong in my config? The code is okay when I use FSDirectoryProvider.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 04, 2008 6:56 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

first of all you will have to make sure that the master node will start first - at the very least for the very first time. The master node is responsible for creating the master index from which the slaves nodes will take their local copy. In your case this master index does not seem to exist.

Also, you are using c:/temp/lucene/mastercopy are source directory for the master. This will only work if you are running master and slave on the same machine. Normally the sourceBase is on a shared file system since master and slave reside on different machines.

--Hardy


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.