3. Install Zookeeper as a service
Installing Zookeeper as a Windows service
As I mentioned before, I used NSSM tool for running both Zookeeper as well as SolrNode as windows services.
Download and un-archive Zookeeper
Zookeeper can be found here. I used latest stable release
Create Zookeeper data folder. For example
zoo_sample.cfgfile in Zookeeper folder to
zoo.cfg(can be found in
Conffolder of Zookeeper distribution)
zoo.cfgto point to the folder created earlier: so it will look like
Add entries for your Zookeeper servers(nodes) into
Note: that should be IP Addresses if the VMs with SolrNodes nodes, not Zookeper ones (this is in case you have your Zookeeper nodes running on dedicated VMs)
That will look like in following example. Please pay attention that since my VMs are in Azure vNet, it uses internal IP addresses there.
server.1=10.1.0.9:2888:3888 server.2=10.1.0.11:2888:3888 server.3=10.1.0.10:2888:3888
Note: important to have such format of the configuration: server. (there must be
.(dot) between, otherwise SolrCloud setup won't work)
Now a bit magical step. In your Zookeeper data folder (defined in step #1, is
c:\zk\datain my example) create file with name
myidwithout extension and add there identificator of your Zookeeper node. The number after
.(dot) from the step #3. So, in my example, for the server with IP
10.1.0.9the contents of the
myidfile should be
1, for the server
2and so on.
Install and run Zookeeper as a Windows service. Use NSSM for that: start following command:
Configure service in the window appeared. Run
<path_to_zookeeper_root>\bin\zkServer.cmdfile. See an example how to install service by NSSM in this example of running standalone Solr service. Basically it is similar process for ZooKeeper as well as for Solr node services to run them as Windows services using NSSM. The difference is just a matter of naming, executable and parameters that should be supplied to that executable.
Don't forget to start your service running following command in CMD:
net start <your_service_name>
Finally, if SolrCloud should be running with SSL turned on, ZooKeeper should have a property
https. For that run following command (for the simplicity sake I left in the command below the path to the Solr distributive, you should of course change that to your one):
c:\solr\solr-6.6.2\server\scripts\cloud-scripts\zkcli -zkhost "10.1.0.9:2181,10.1.0.10:2181,10.1.0.11:2181" -cmd clusterprop -name urlScheme -val https
Of course do steps above on all the VMs that you want to use as Zookeeper nodes