How to Deploy Apache Solr as SolrCloud on HDFS in a Production Cluster

Harsh Jain
Apr 27, 2016 · 6 min read

#Requirements for this guide


#Install Lucidworks-HDPsearch package

yum install lucidworks-hdpsearch
/opt/lucidworks-hdpsearch 

#Notes on Config files for HDFS

/opt/lucidworks-hdpsearch/solr/server/solr/configsets

#Modifing Config files for HDFS

<directoryFactory name=”DirectoryFactory”
class=”${solr.directoryFactory:solr.NRTCachingDirectoryFactory}”>
</directoryFactory>
<directoryFactory name=”DirectoryFactory” class=”solr.HdfsDirectoryFactory”>
<str name=”solr.hdfs.home”>hdfs://<host:port>/user/solr</str>
<str name=”solr.hdfs.confdir”>/etc/hadoop/conf</str>
<bool name=”solr.hdfs.blockcache.enabled”>true</bool>
<int name=”solr.hdfs.blockcache.slab.count”>1</int>
<bool name=”solr.hdfs.blockcache.direct.memory.allocation”>true</bool>
<int name=”solr.hdfs.blockcache.blocksperbank”>16384</int>
<bool name=”solr.hdfs.blockcache.read.enabled”>true</bool>
<bool name=”solr.hdfs.nrtcachingdirectory.enable”>true</bool>
<int name=”solr.hdfs.nrtcachingdirectory.maxmergesizemb”>16</int>
<int name=”solr.hdfs.nrtcachingdirectory.maxcachedmb”>192</int>
</directoryFactory>

*optional*


# Changing to Solr user

Sudo su — solr(input password)

#Starting Solr

/opt/lucidworks-hdpsearch/solr/
bin/solr start -c (1)
-z 10.0.0.1:2181,10.0.0.2:2181,10.0.0.3:2181 (2)
-Dsolr.directoryFactory=HdfsDirectoryFactory (3)
-Dsolr.lock.type=hdfs (4)
-Dsolr.hdfs.home=hdfs://host:port/path (5)

#Adding nodes to Solr

ssh <nodeName>yum install lucidworks-hdpsearch

#Creating your first collection

bin/solr create -c SolrCollection (1)
-d data_driven_schema_configs (2)
-n mySolrConfigs (3)
-s 2 (4)
-rf 2 (5)

#Verify & Enjoy!

<hostname:8983>/solr

Harsh Jain

Written by

You know, the only thing I’ve never lost -is curiosity. Engr || Entrepreneur. Perpetual Wanderlust. Literary nerd. @themoochapp #BigData #Analytics #Datascience

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade