You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Paolo Castagna <ca...@googlemail.com> on 2010/04/07 18:00:44 UTC

Is it possible to have Lucene and Solr (or two Solr instances) pointing at the same index directory?

Hi,
(I know that this is probably not recommended and not a common
scenario, but...)

Is it possible to have an application using Lucene and a separate
(i.e. different JVM) instance of Solr both pointing at the same
index and read/write to the index from both applications?

I am trying (separately) two lockType settings in solrconfig.xml:
"native" and "simple" and the corresponding SimpleFSLockFactory
and NativeFSLockFactory with Lucene.

I have noticed that if I use:

   Directory dir = FSDirectory.open(
                     new File(path),
                     new SimpleFSLockFactory(path));

The lock file is called "writer.lock", while if I use:

   Directory dir = FSDirectory.open(new File(path));
   dir.setLockFactory(new SimpleFSLockFactory(path));

The lock file is called "lucene-{number}-writer.lock".

Solr uses the second method to set a custom lock factory.

Is the {number} supposed to be unique and the always same across
different JVMs?

I have also noticed that when Solr starts it creates a lock file even
if there are no updates or commits to the index. Why? Is this normal?

Finally, I would like to know if what I am doing is possible, what
are the potential problems and if people with more experience with
Lucene and Solr have suggestions on recommended settings or best
practices.

Thanks,
Paolo

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org