3. Starting Solr in Cloud Mode with Embedded Zookeeper: Interactive Script Method

SolrCloud is designed to provide a fault tolerant, scalable and highly available environment for created web application that can index the data for searching. This can be done by distributing your indexed content at different servers and querying user’s requests across those multiple servers.

Your information is indexed and stored in “collections” which is then distributed to a group of machines that work together to provide storage and search results which is called a SolrCloud Cluster.

An embedded Zookeeper server is also bundled with Solr that helps to manage the overall structure so that both indexing and search requests can be routed properly.

1. Starting SolrCloud

To launch Solr in Cloud mode with an embedded Zookeeper run the following command:

$bin/solr -e cloud

Starting SolrCloud

This starts an interactive session which takes us through the easy steps of setting up a simple SolrCloud cluster with embedded Zookeeper. All of the defaults will be fine.

Now, we have to give two port numbers to the created nodes for our SolrCloud cluster.

created nodes for our SolrCloud cluster

We can provide the name to create a new collection or choose to use the previously created collection.

created nodes for our SolrCloud cluster

You can visit http://localhost:8983/solr to check the status of SolrCloud.

status of SolrCloud

After logging into SolrCoud GUI, we can check the number of shards and replicas created in the Graph section.

SolrCoud GUI
solr collections

2. Posting Documents in a Collection

We can post the documents to be indexed into your collection by giving following command,

$ ./bin/post -c Collection1 example/exampledocs/*xml

Posting Documents in a Collection
solr collection overview

3. Running Query on the Documents

We can query the documents in our collection by giving input in -q parameter.

Running Query on the Documents

After running the query we will get the results in the form of fields as described in the chosen configuration or schema.

solr collection query