With SolrCloud your configuration files are kept in ZooKeeper.
These files are uploaded in either of the following cases:
When you start a SolrCloud example using the
When you create a collection using the
Explicitly upload a configuration set to ZooKeeper.
When you try SolrCloud for the first time using the
bin/solr -e cloud, the related configset gets uploaded to ZooKeeper automatically and is linked with the newly created collection.
The below command would start SolrCloud with the default collection name (gettingstarted) and default configset (_default) uploaded and linked to it.
bin/solr -e cloud -noprompt
You can also explicitly upload a configuration directory when creating a collection using the
bin/solr script with the
-d option, such as:
bin/solr create -c mycollection -d _default
The create command will upload a copy of the
_default configuration directory to ZooKeeper under
/configs/mycollection. Refer to the Solr Control Script Reference page for more details about the create command for creating collections.
Once a configuration directory has been uploaded to ZooKeeper, you can update them using the Solr Control Script
|It’s a good idea to keep these files under version control.|
Uploading Configuration Files using bin/solr or SolrJ
The below command can be used to upload a new configset using the bin/solr script.
bin/solr zk upconfig -n <name for configset> -d <path to directory with configset>
It is strongly recommended that the configurations be kept in a version control system, Git, SVN or similar.
Managing Your SolrCloud Configuration Files
To update or change your SolrCloud configuration files:
Download the latest configuration files from ZooKeeper, using the source control checkout process.
Make your changes.
Commit your changed file to source control.
Push the changes back to ZooKeeper.
Reload the collection so that the changes will be in effect.
Preparing ZooKeeper before First Cluster Start
If you will share the same ZooKeeper instance with other applications you should use a chroot in ZooKeeper. Please see ZooKeeper chroot for instructions.
There are certain configuration files containing cluster wide configuration. Since some of these are crucial for the cluster to function properly, you may need to upload such files to ZooKeeper before starting your Solr cluster for the first time. Examples of such configuration files (not exhaustive) are
If you for example would like to keep your
solr.xml in ZooKeeper to avoid having to copy it to every node’s
solr_home directory, you can push it to ZooKeeper with the bin/solr utility (Unix example):
bin/solr zk cp file:local/file/path/to/solr.xml zk:/solr.xml -z localhost:2181