SolrCloud Management In Cloudera Distribution of Hadoop: solrctl Commands

Cloudera’s Hadoop comes with a utility script called solrctl that allows you to manage SolrCloud. You can do things related to instance directory, instance configuration and collections among others. Before I get into the commands I would like to discuss a little bit about the workflow that is commonly used when you want to create a collection. Basically you follow the following steps:

  • You create an instance directory: this is where your collection’s configuration is stored
  • You upload the configuration to SolrCloud
  • Then you create a collection: this will use the configuration you uploaded earlier. Note: at the time of collection creation it looks for the configuration with the same name as the configuration you uploaded earlier
  • Finally, you index the data

It is very common to tweak configuration several times to figure out the best configuration that matches the goals of your project during indexing and at the time of query. In such cases, the configuration that was uploaded needs to be updated several times during the course of your project. Similarly, the corresponding collections are also updated several times. solrctl utility may be come in handy in handling these types of work.

Handling instance directory
Create an instance director with Solr’s template configuration. This creates a conf folder inside the specified path with default Solr configurations. You can tweak these configurations as per your needs

solrctl instancedir –generate $HOME/solr_config_dir


Upload configurations in instance directory to SolrCloud

solrctl instancedir --create config_name $HOME/solr_config_dir


Update the configuration in SolrCloud. Let’s say you made some tweaks to the Solr configuration in local and now you want to update the configuration in the SolrCloud

solrctl instancedir --update config_name $HOME/solr_config_dir


Handling collection

Create a collection with the configuration you created earlier. -s option is added to select the number of shards. Collection name should be the same as the configuration name you created earlier

solrctl collection --create collection_name -s 2

List all Solr collections

solrctl collection --list

Delete a collection

solrctl collection --delete collection_name


Related articles:

Reference: SolrCtl