ZooKeeper Utilities

The Solr Command Line Interface (CLI) script is available to allow you to interact directly with Solr configuration files stored in ZooKeeper.

While Solr’s Admin UI includes pages dedicated to the state of your SolrCloud cluster, it does not allow you to download or modify related configuration files.

See the section Cloud Screens for more information about using the Admin UI screens.

The ZooKeeper specific commands are provided by the Solr Control Script.

Solr’s zkcli.sh vs ZooKeeper’s zkCli.sh

The deprecated zkcli.sh provided by Solr is not the same as the zkCli.sh included in ZooKeeper distributions.

ZooKeeper’s zkCli.sh provides a completely general, application-agnostic shell for manipulating data in ZooKeeper.

zkcli.sh has been deprecated in favour of the bin/solr equivalent commands which should be used instead. It is no longer referenced in the Reference Guide.

Using Solr’s ZooKeeper CLI

Use the help option to get a list of available ZooKeeper specifc commands from the script itself, as in bin/solr zk -h.

Solr CLI Examples

Below are some examples of using the bin/solr CLI which assume you have already started the SolrCloud example (bin/solr start -e cloud --no-prompt)

Upload a Configuration Directory

bin/solr zk upconfig -z 127.0.0.1:9983 -n my_new_config -d server/solr/configsets/_default/conf

Put a Local File into a New ZooKeeper File

./bin/solr zk cp ./my_local_file.txt zk:/my_zk_file.txt -z 127.0.0.1:9983
./bin/solr zk linkconfig --conf-name my_new_config -c gettingstarted -z 127.0.0.1:9983

Create a New ZooKeeper Path

This can be useful to create a chroot path in ZooKeeper before first cluster start.

bin/solr zk mkroot /solr -z 127.0.0.1:9983

Set a Cluster Property

This command will add or modify a single cluster property in clusterprops.json.

Unlike the CLUSTERPROP command on the Collections API, this command does not require a running Solr cluster.

bin/solr cluster --property urlScheme --value https -z 127.0.0.1:9983
This command is not nested under bin/solr zk like the others.