Saturday 3 January 2015

Setup SolrCloud


This post explain how to install the solr cluster. The below installation steps, install and run the solr cluster. After installation of cluster, you can create the indexes, aliases and fields by providing the solrconfig.xml and schema.xml file.

Perform the below steps on all nodes where you wants to install the Solr.

 1.Download the Solr bundle from http://archive.apache.org/dist/lucene/solr/4.7.2/solr-4.7.2.zip using the below command:



2. Unzip the downloaded bundle:

 unzip solr-4.7.2.zip

3. Create a solr home directory to store the solr data:

 mkdir-p solr/home/

4. Move to the solr home directory and create an file named “solr.xml”:

 cd solr/home/

Create the solr.xml file and add the following content in it.

 <?xml version="1.0" encoding="UTF-8" ?>

 <solr>
  <!-- Values in this file will be supplied from command prompt while starting the solr -->

  <solrcloud>
   <str name="host">${host:}</str>
   <int name="hostPort">${jetty.port:}</int>
   <str name="hostContext">${hostContext:solr}</str>
   <int name="zkClientTimeout">${zkClientTimeout:30000}</int>
   <bool name="genericCoreNodeNames">${genericCoreNodeNames:true}</bool>
  </solrcloud>

  <shardHandlerFactory name="shardHandlerFactory"class="HttpShardHandlerFactory">
   <int name="socketTimeout">${socketTimeout:0}</int>
   <int name="connTimeout">${connTimeout:0}</int>
  </shardHandlerFactory>
 </solr>
5. Now move to the example directory available inside the extracted solr folder:

 cd solr-4.7.2/example/

6. Before starting the solr, you should have running zookeeper cluster. Solr need the IP address and port of zookeeper to start.

nohup java -Xms128M -Xmx1024M -Dsolr.solr.home=solr/home/ -Djetty.port=8983 -DzkHost= zkHost1:2181,zkHost2:2181,zkHost3:2181 -DzkClientTimeout=10000 -DsocketTimeout=1000 -DconnTimeout=1000 -DhostContext=/solr -jar start.jar &

No comments:

Post a Comment