ZooKeeper File Management
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
Refer to the Solr Control Script Reference 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.
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>
The following code shows how this can also be achieved using SolrJ:
It is strongly recommended that the configurations be kept in a version control system, Git, SVN or similar.
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.
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 enable authentication, you can push your
security.json file to ZooKeeper with the bin/solr utility (Unix example):
bin/solr zk cp file:local/file/path/to/security.json zk:/security.json -z localhost:2181
If you have defined
solr.in.cmd (see xref:zookeeper-ensemble.adoc#updating-solr-include-files,Updating Solr Include Files>>) you can omit
-z <zk host string> from the above command.