Reputation: 31
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 ?
inside we put parameters and values
dihBddHost=host
dihBddPort=3306
dihBddDatabase=mydatabase
dihBddLogin=mylogin
dihBddPassword=mypassword
in solrconfig.xml, on the DataImportHandler part, we did
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="update.chain">langid</str>
<str name="config">db-data-config.xml</str>
</lst>
<lst name="invariants">
<str name="dihBddHost">${dihBddHost}</str>
<str name="dihBddPort">${dihBddPort}</str>
<str name="dihBddDatabase">${dihBddDatabase}</str>
<str name="dihBddLogin">${dihBddLogin}</str>
<str name="dihBddPassword">${dihBddPassword}</str>
</lst>
</requestHandler>
When I change my solrcore.properties, first, it put the change in zookeeper (going in /var/opt/solr4.5/myapp/solr/)
cloud-scripts/zkcli.sh -cmd upconfig -zkhost 127.0.0.1:2181 -d /var/opt/solr4.5/myapp/solr/mycore/conf -n conf_one
http://myserveur:8983/solr/admin/collections?action=RELOAD&name=collection_one
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
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
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