user3057010
user3057010

Reputation: 31

SolrCloud - Update information solrcore.properties not working unless we restart Jetty

We have - 3 ZooKeepers runnings ( standalone, not the one embeded with SolrCloud) - 2 Solr instance ( version 4.5)

In our conf directory, we add the file solrcore.properties in order to put dynamic parameters for dataimporthandler. Everything works fine (see below for how we did it, it might help people too).

The problem is when I want to change a value it's not working unless I restart Jetty ?

If I go to Solr Administration, on "Cloud" menu > "Tree" > "/configs" > "conf_one", I can see my file solrcore.properties changed.

So is there a solution to load a change without restarting Jetty instance ?

Upvotes: 2

Views: 1410

Answers (2)

bpanulla
bpanulla

Reputation: 2998

I also needed to set multiple properties, and I found a simpler way to do it rather than injecting them all individually into the CREATE collection command. Just add the "properties" property (see the documentation ) containing a path to your main properties file:

http://myserver:8983/solr/admin/cores?action=CREATE&name=core_one&collection=collection_one&collection.configName=conf_one&property.properties=/var/lib/solr/allcore.properties

Specifically:

&property.properties=/var/lib/solr/allcore.properties

and deploy allcore.properties file to each node in your cluster.

Upvotes: 0

user3057010
user3057010

Reputation: 31

Ok after reading many threads and JIRA over the web, I figure out that having a solrcore.properties in zookeeper is not the good way to do. In fact your instance may have different value even for the same collection.

So, what I have done, is to create my core with CoreAdmin, and I put directly my properties there in order to set up everthing on create.

Exemple :

http://myserver:8983/solr/admin/cores?action=CREATE&name=core_one&collection=collection_one&collection.configName=conf_one&property.dihBddHost=myhost&property.dihBddPort=3306&property.dihBddDatabase=mydatabase&property.dihBddLogin=mylogin&property.dihBddPassword=mypassword

And in solrconfig.xml, don't forget to put default value, in order to avoid some errors ;-)

<!-- Data Import Handler -->
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
    <lst name="defaults">
        <str name="config">db-data-config.xml</str>
    </lst>
    <lst name="invariants"> 
        <str name="dihBddHost">${dihBddHost:myhost}</str> 
        <str name="dihBddPort">${dihBddPort:3306}</str> 
        <str name="dihBddDatabase">${dihBddDatabase:mydatabase}</str> 
        <str name="dihBddLogin">${dihBddLogin:mylogin}</str> 
        <str name="dihBddPassword">${dihBddPassword:mypassword}</str> 
    </lst>  
</requestHandler>  

Once the core is created, if you open the file core.properties then you'll see your own properties written.

Very userful for having same conf files in DEV / TEST / PROD environnement but different value for connection.

Hope it helps.

Upvotes: 1

Related Questions