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.
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
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 192.168.0.1 will contain “1” and 192.168.0.3 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 myidtags: zookeeper - solr - solrcloud