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 Marc Wilson <wo...@fancydressoutfitters.co.uk> on 2010/03/03 12:51:17 UTC

Re-index after Solr config file changed without restarting services

Hi,

I am attempting to achieve what I believe many others have attempted in the past: allow an end user to modify a Solr config file through a custom UI and then roll out any changes made without restarting any services. Specifically, I want to be able to let the user edit the synonyms.txt file and after committing the changes, force Solr to re-index based on those changes without restarting Tomcat.

I have configured a Solr Master and Slave, each of which has a single core:


*         http://master:8080/solr/core

*         http://slave:8080/solr/core

The cores are defined in respective solr.xml files as:

<solr persistent="true" sharedLib="lib">
 <cores adminPath="/admin/cores">
  <core name="core" instanceDir="core">
    <property name="configDir" value="../../conf/" />
  </core>
 </cores>
</solr>

Replication has been configured in the Master solrconfig.xml as follows:

<requestHandler name="/replication" class="solr.ReplicationHandler" >
    <lst name="master">
        <str name="replicateAfter">startup</str>
        <str name="replicateAfter">commit</str>
        <str name="snapshot">startup</str>
        <str name="snapshot">commit</str>
        <str name="confFiles">schema.xml,${configDir}stopwords.txt,${configDir}elevate.xml,${configDir}synonyms.txt</str>
    </lst>
</requestHandler>

and the Slave solrconfig.xml as:

<requestHandler name="/replication" class="solr.ReplicationHandler" >
    <lst name="slave">
      <str name="masterUrl">http://master:8080/solr/core/replication</str>
      <str name="compression">internal</str>
      <str name="httpConnTimeout">5000</str>
      <str name="httpReadTimeout">10000</str>
      <str name="httpBasicAuthUser">username</str>
      <str name="httpBasicAuthPassword">password</str>
      <str name="pollInterval">00:00:20</str>
     </lst>
</requestHandler>

At service startup, replication works fine. However, when a change is made to the synonyms.txt file and http://master:8080/solr/admin/cores?action=RELOAD&core=core is called neither the Master nor Slave are updated to reflect the modification. I am assuming that this is because in the Master schema.xml file the SynonymFilterFactory is being used at index time and the CoreAdmin RELOAD does not force a Solr re-index. If this is so, please can someone advise what the best methodology is to achieve what I am attempting? If not, please could someone let me know what I'm doing wrong?!

Thanks,

Marc

Re: Re-index after Solr config file changed without restarting services

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Marc,

At least for the "force Solr to reindex" part, I think you'll need to index yourself.  That is, you need to run whatever app you run when you (re)index the data normally.  Solr won't automagically reindex the data.

Otis
----
Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch
Hadoop ecosystem search :: http://search-hadoop.com/



----- Original Message ----
> From: Marc Wilson <wo...@fancydressoutfitters.co.uk>
> To: Solr <so...@lucene.apache.org>
> Sent: Wed, March 3, 2010 6:51:17 AM
> Subject: Re-index after Solr config file changed without restarting services
> 
> Hi,
> 
> I am attempting to achieve what I believe many others have attempted in the 
> past: allow an end user to modify a Solr config file through a custom UI and 
> then roll out any changes made without restarting any services. Specifically, I 
> want to be able to let the user edit the synonyms.txt file and after committing 
> the changes, force Solr to re-index based on those changes without restarting 
> Tomcat.
> 
> I have configured a Solr Master and Slave, each of which has a single core:
> 
> 
> *        http://master:8080/solr/core 
> 
> *        http://slave:8080/solr/core 
> 
> The cores are defined in respective solr.xml files as:
> 
> 
> 
>   
>     
>   
> 
> 
> 
> Replication has been configured in the Master solrconfig.xml as follows:
> 
> 
>     
>         startup
>         commit
>         startup
>         commit
>         
> name="confFiles">schema.xml,${configDir}stopwords.txt,${configDir}elevate.xml,${configDir}synonyms.txt
>     
> 
> 
> and the Slave solrconfig.xml as:
> 
> 
>     
>       http://master:8080/solr/core/replication
>       internal
>       5000
>       10000
>       username
>       password
>       00:00:20
>     
> 
> 
> At service startup, replication works fine. However, when a change is made to 
> the synonyms.txt file and 
> http://master:8080/solr/admin/cores?action=RELOAD&core=core is called neither 
> the Master nor Slave are updated to reflect the modification. I am assuming that 
> this is because in the Master schema.xml file the SynonymFilterFactory is being 
> used at index time and the CoreAdmin RELOAD does not force a Solr re-index. If 
> this is so, please can someone advise what the best methodology is to achieve 
> what I am attempting? If not, please could someone let me know what I'm doing 
> wrong?!
> 
> Thanks,
> 
> Marc