SolrCloud is the name of a set of new distributed capabilities in Solr. Passing parameters to enable these capabilities will enable you to set up a highly available, fault tolerant cluster of Solr servers. Use SolrCloud when you want high scale, fault tolerant, distributed indexing and search capabilities.
A little about SolrCores and Collections
On a single instance, Solr has something called a SolrCore that is essentially a single index. If you want multiple indexes, you create multiple SolrCores. With SolrCloud, a single index can span multiple Solr instances. This means that a single index can be made up of multiple SolrCore‘s on different machines. We call all of these SolrCores that make up one logical index a collection. A collection is a essentially a single index that spans many SolrCore‘s, both for index scaling as well as redundancy. If you wanted to move your 2 SolrCore Solr setup to SolrCloud, you would have 2 collections, each made up of multiple individual SolrCores.
Steps to install SolrCloud :
- Download solr-4.10.0 from http://lucene.apache.org/solr/downloads.html and unzip it.
The process of creating a cluster consisting of two solr servers representing two different shards of a collection :
- Since we’ll need two solr servers for this, simply make a copy of the unzip solr folder for the second server — making sure you don’t have any data already indexed.
In command prompt go to example folder and then –
cp –r solr4.10.0 solr2
- Go to example folder of first solr1 server in command prompt.
- Now enter the command starts up a Solr server and bootstraps a new solr cluster.
java -Dbootstrap_confdir=./solr/collection1/conf -Dcollection.configName=myconf -DzkRun -DnumShards=2 -jar start.jar
-Dbootstrap_confdir : path to configuration directory. Can be set according to location of the conf folder.
-Dcollection.configName : name of conf folder on zookeeper.
-DnumShards : number of shards.
- Browse to http://localhost:8983/solr/#/~cloud to see the state of the cluster
- Then start the second server, pointing it at the cluster
Go to example folder of solr2 server:
cd example2 java -Djetty.port=7574 -DzkHost=localhost:9983 -jar start.jar
- You can see how your collection is deployed across the cluster by visiting the cloud panel in the Solr Admin UI: http://localhost:8983/solr/#/~cloud
- To check health of cluster :
solr healthcheck -c collection name