Preparing Zookeeper for SolrCloud 7.7.

Created: 18 April 2019  Modified:

One of the key ingredients to get SolrCloud working is setting up Zookeeper. The Solr website has a good article on preparing Zookeeper for SolrCloud. I had done this a few years ago, for Solr 4. Found myself a little disoriented when I came back, to do the same, for Solr 7.7. Reading the link above is recommended if you are not familiar with Zookeeper. I will be using cluster and ensemble interchangeable. As well as server and node.

First lets define our cluster/ensemble. We’ll make it a simple cluster of three nodes.

Good Diagram

Deployment will consist of placing Zookeeper server in /your/directory/path/zookeeper. Then we make and deploy the same zoo.cfg file to all the servers/nodes. This is followed by creating a myid file which is different on all the nodes. This is a basic setup and doesn’t include security and monitoring. Download the latest Zookeeper and extract it to a location where you can browse and add/change files.

The first step is to create our zoo.cfg file that will be deployed to all the servers/nodes. You can set a custom client port. In this example I have set it to the default which is 2181. If you do set a differenct port number see Zookeeper: Useful Command Line


 # The number of milliseconds of each tick
=  The number of ticks that the initial
=  synchronization phase can take
=  The number of ticks that can pass between
=  sending a request and getting an acknowledgement

=  the directory where the snapshot is stored.
=  dataDir=/opt/zookeeper/data
=  NOTE: Solr defaults the dataDir to <solrHome>/zoo_data

=  the port at which the clients will connect
=  NOTE: Solr sets this based on zkRun / zkHost params

= Remove old stuff

Now we create our myid file. This contains a number that corresponds to the server entries in the zoo.cfg. So the myid file for will contain “1” and myid file will contain “3”.



As part of a deploy script I found the following Linux command lines useful for automatically creating the myid files on the servers. This would need to be run on the target servers.

parse zoo.cfg and find myid

cat /apps01/zookeeper/conf/zoo.cfg | grep $(hostname -i) | cut -d'=' -f 1 | cut -d'.' -f 2 > /your/directory/path/zookeeper/data/myid
tags: zookeeper - solr - solrcloud
   Less Is More