aswath86
aswath86

Reputation: 571

Update solr config files in solrcloud

Hi fellow SOLR developers,

https://cwiki.apache.org/confluence/display/solr/Using+ZooKeeper+to+Manage+Configuration+Files This link says the below

To update or change your SolrCloud configuration files:

 1. Download the latest configuration files from ZooKeeper, using the
    source control checkout process. 
 2. Make your changes. Commit your changed file to source control. 
 3. Push the changes back to ZooKeeper.
 4. Reload the collection so that the changes will be in effect.

But I was wondering if there are some examples or articles somewhere which can help me do this. For instance, how would one download the latest config files from zookeeper? Or should I know Zoopkeeper in-and-out to do this?

Version 5.3.1

I updated the synonym file in the "C:\12345\solrcloud\solr-5.3.1\example\example-DIH\solr\db\conf" folder and I'm using the below command

zkcli -zkhost localhost:2181,localhost:2182,localhost:2183 -cmd upconfig -confname db_config -confdir "C:\12345\solrcloud\solr-5.3.1\example\example-DIH\solr\db\conf"

But the file doesn't seem to change nor the query seem to work. I reloaded the core which did not help too. I even tried restarting my solrcloud.

Upvotes: 0

Views: 1897

Answers (3)

Dimanshu Parihar
Dimanshu Parihar

Reputation: 377

My Brother, you are using upconfig command....

Same way there is a command called downconfig with same parameters. So your order of execution will be :

  1. Downconfig
  2. Change the config
  3. Upconfig

Downconfig command :

bin/solr zk downconfig -z 111.222.333.444:2181 -n mynewconfig -d /path/to/configset

Upconfig command :

bin/solr zk upconfig -z 111.222.333.444:2181 -n mynewconfig -d /path/to/configset

Upvotes: 4

whomer
whomer

Reputation: 615

After you update the file in Zookeeper, you need to tell solr to reload the collection, this tells solr to get the new configuration from Zookeeper. See the Reload Solr Collection REST call: https://cwiki.apache.org/confluence/display/solr/Collections+API#CollectionsAPI-api2

Upvotes: 0

huyangc
huyangc

Reputation: 1

I think this short code can help to download the configs of solrcloud from zookeeper.

public void exportSynonyms(...) {
    try {
        final CloudSolrClient cloudSolrClient = ... //Retrieve the Solr client
        final String configName = cloudSolrClient.getDefaultCollection();
        final Path configPath = ... //Get or create temporary local file path
        cloudSolrClient.downloadConfig(configName, configPath);
        // Do something
        cloudSolrClient.uploadConfig(configPath, configName);
        // Reload the collection
    } catch (RestClientException | SolrServiceException | IOException var11){
        this.handleException(var11);
    }
}

And I met the same problem and asked it on https://cwiki.apache.org/confluence/display/solr/Using+ZooKeeper+to+Manage+Configuration+Files?focusedCommentId=65147407#comment-65147407

Hope it can help you.

Upvotes: 0

Related Questions