You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Bing Hua <bh...@cornell.edu> on 2012/08/06 19:56:00 UTC

Multiple Embedded Servers Pointing to single solrhome/index

Hi,

I'm trying to use two embedded solr servers pointing to a same solrhome /
index. So that's something like

        System.setProperty("solr.solr.home", "SomeSolrDir");
        CoreContainer.Initializer initializer = new
CoreContainer.Initializer();
        CoreContainer coreContainer = initializer.initialize();
        m_server = new EmbeddedSolrServer(coreContainer, "");

on both applications. The problem is, after I have done one add+commit
SolrInputDocument on one embedded server, the other server would fail to
obtain write lock any more. I'm thinking there must be a way of releasing
write lock so other servers may pick up. Is there an API that does so?

Any inputs are appreciated.
Bing

Re: Multiple Embedded Servers Pointing to single solrhome/index

Posted by Bing Hua <bh...@cornell.edu>.
I agree. We chose embedded to minimize the maintenance cost of http solr
servers.

One more concern. Even if I have only one node doing indexing, other nodes
need to reopen index reader periodically to catch up with new changes,
right? Is there a solr request that does this?

Thanks,
Bing



--
View this message in context: http://lucene.472066.n3.nabble.com/Multiple-Embedded-Servers-Pointing-to-single-solrhome-index-tp3999451p4000269.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Multiple Embedded Servers Pointing to single solrhome/index

Posted by Mark Miller <ma...@gmail.com>.
Yeah, that is not really supported. One write lock and one IndexWriter per index.

If you use embedded you want to share your CoreContainer, else don't use embedded.

On Aug 6, 2012, at 1:56 PM, Bing Hua <bh...@cornell.edu> wrote:

> Hi,
> 
> I'm trying to use two embedded solr servers pointing to a same solrhome /
> index. So that's something like
> 
>        System.setProperty("solr.solr.home", "SomeSolrDir");
>        CoreContainer.Initializer initializer = new
> CoreContainer.Initializer();
>        CoreContainer coreContainer = initializer.initialize();
>        m_server = new EmbeddedSolrServer(coreContainer, "");
> 
> on both applications. The problem is, after I have done one add+commit
> SolrInputDocument on one embedded server, the other server would fail to
> obtain write lock any more. I'm thinking there must be a way of releasing
> write lock so other servers may pick up. Is there an API that does so?
> 
> Any inputs are appreciated.
> Bing

- Mark Miller
lucidimagination.com












Re: Multiple Embedded Servers Pointing to single solrhome/index

Posted by Bing Hua <bh...@cornell.edu>.
Makes sense. Thank you.



--
View this message in context: http://lucene.472066.n3.nabble.com/Multiple-Embedded-Servers-Pointing-to-single-solrhome-index-tp3999451p4000180.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Multiple Embedded Servers Pointing to single solrhome/index

Posted by Lance Norskog <go...@gmail.com>.
No, you can only have one program controlling an index. This will not
work! You should use a primary/failover technique where one program
does all of the indexing, and then another program is the fallback for
the first indexer.

On Tue, Aug 7, 2012 at 7:31 AM, Bing Hua <bh...@cornell.edu> wrote:
> Thanks Lance. The use case is to have a cluster of nodes which runs the same
> application with EmbeddedSolrServer on each of them, and they all point to
> the same index on NFS. Every application is designed equal, meaning that
> everyone may index and/or search.
>
> In such way, after every commit the writer needs to be closed for other
> nodes' availability.
>
> Do you see any issues of this use case? Is the EmbeddedSolrServer able to
> release its write lock without shutting down?
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Multiple-Embedded-Servers-Pointing-to-single-solrhome-index-tp3999451p3999591.html
> Sent from the Solr - User mailing list archive at Nabble.com.



-- 
Lance Norskog
goksron@gmail.com

Re: Multiple Embedded Servers Pointing to single solrhome/index

Posted by Bing Hua <bh...@cornell.edu>.
Thanks Lance. The use case is to have a cluster of nodes which runs the same
application with EmbeddedSolrServer on each of them, and they all point to
the same index on NFS. Every application is designed equal, meaning that
everyone may index and/or search. 

In such way, after every commit the writer needs to be closed for other
nodes' availability.

Do you see any issues of this use case? Is the EmbeddedSolrServer able to
release its write lock without shutting down?



--
View this message in context: http://lucene.472066.n3.nabble.com/Multiple-Embedded-Servers-Pointing-to-single-solrhome-index-tp3999451p3999591.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Multiple Embedded Servers Pointing to single solrhome/index

Posted by Lance Norskog <go...@gmail.com>.
Where is the common index? On NFS?

If it is on a native hard disk (on the same computer) Solr uses the
file locking mechanism supplied by the operating system (Linux or
Windows). This may not be working right. See this for more info on
file locking:
http://wiki.apache.org/lucene-java/AvailableLockFactories

On Mon, Aug 6, 2012 at 10:56 AM, Bing Hua <bh...@cornell.edu> wrote:
> Hi,
>
> I'm trying to use two embedded solr servers pointing to a same solrhome /
> index. So that's something like
>
>         System.setProperty("solr.solr.home", "SomeSolrDir");
>         CoreContainer.Initializer initializer = new
> CoreContainer.Initializer();
>         CoreContainer coreContainer = initializer.initialize();
>         m_server = new EmbeddedSolrServer(coreContainer, "");
>
> on both applications. The problem is, after I have done one add+commit
> SolrInputDocument on one embedded server, the other server would fail to
> obtain write lock any more. I'm thinking there must be a way of releasing
> write lock so other servers may pick up. Is there an API that does so?
>
> Any inputs are appreciated.
> Bing



-- 
Lance Norskog
goksron@gmail.com