SolrCloud with External Zookeeper, SETUP and START, STOP Commands
- Download zookeeper:
- zookeeper downloads from Apache - choose mirror closest to you:
- Solr downloads from Apache:
- Unzip. Navigate to the subfolder /conf. Edit the zoo_sample.cfg by including the correct/existing dataDir path and save. Rename it to zoo.cfg
- Start zookeeper through shell. Navigate to /bin folder [cd /users/rajani/zookeeper/bin] and start with command - ./zkServer.sh start
- Your zookeeper is now started and up. You can cross check it status by using the command - ./zkServer.sh status
- Incase, If you would like to connect to zookeeper shell and check out directories existing in it, you can do so by executing the following commands. Navigate to bin and command - ./zkCli.sh -server 127.0.0.1:2181
- You could use ls / command to list the directories available in zoo.
- Download solr from Apache Solr website
- Unzip. First, let’s start solrcloud with the example collection[gettingstarted] created. This helps us to bring up the necessary base required to further create our own custom collection, adding new nodes and etc. To start solrcloud cluster in interactive mode and that pointing to external zookeeper that we have set up above, follow the below commands.
Navigate to bin, cd /users/rajani/solr_5.2.1/bin/ and ./solr start -e cloud -noprompt -z localhost:2181
- This will start solr on ports 8983 and 7574
- Connect to solr http://localhost:8983/solr/#/~cloud and confirm the cloud setup
- You can now create custom collections on top of this. Command to create a new collection is as follows
- First, use ./solr create_collection -help. These help tips will assist you with each param description
- ./solr create_collection -c testCollection -n testCollection_Config -d /Users/rajanishivarajmaski1/Lucidworks/SOLR/solr-5.2.1/server/solr/configsets/basic_configs/
- repeat step 4
Stop and Start Solr cluster
- Now we will stop only solr nodes. Solr node are running on port 8983 and 7574
- To stop each node, use the command - ./solr stop -p <portnumber>
./solr stop -p 8983
./solr stop -p 7574
- To stop all the nodes in one command, use ./solr stop -all
- Please note that your zookeeper is still up and running. Though solr nodes are stopped.
- If zookeeper goes down and solr nodes are still running, then solr nodes will just serve search requests, denying update requests. Its important that zookeeper is always up and running. Therefore dedicated amount of memory and fault tolerant machine should be dedicated to Zookeeper. Zookeeper acts as a manager to whole cloud setup. If zookeeper is down, cluster itself is down too. So it is always recommended to have a zookeeper quorum in production setup.
- You can bring down zookeeper using the command ./zkServer.sh stop
- Now if you are willing to bring back the cluster, it is important that you start the Zookeeper first. Without zookeeper, solr cannot start in cloud mode. If you still don’t pass zookeeper details ‘-z’ param and ask solr to start in cloud mode, it will try to run on its embedded zookeeper.
- Pass on the running zookeeper details [-z localhost:2181] and start each node. To start back, commands are
- Start zookeeper - ./zkServer.sh start [assuming that this is running on same port - 2181]
- Start each solr node
./solr start -cloud -s /Users/rajani/solr-5.2.1/example/cloud/node1/solr -p 8983 -z localhost:2181 -m 512m
./solr start -cloud -s /Users/rajani/solr-5.2.1/example/cloud/node2/solr -p 7574 -z localhost:2181 -m 512m