Installing Apache Solr in Pseudo Distributed Cluster

Hi Solr Learners,

This article shows you how to install Single Node Solr in your machine. After installing Single Node Solr you can view the Solr running in your machine using UI. Follow the below steps carefully to get Solr installed in your own machine.

Solr_pseudo_node_installation

1. Solr Download
To get the latest version of Apache Solr ,visit Solr official web Site

2. Download the Java from Oracle. Kindly check for Oracle website if the link is broken. Kindly check for current version in the Oracle Site.
$ wget http://mirrors.ibiblio.org/apache/lucene/solr/4.10.3/solr-4.10.3.tgz

3. Untar Solr
$ tar -zxvf solr-4.10.3.tgz

4. Set JAVA PATH in .bashrc
$ vi .bashrc

export JAVA_HOME=/home/saravanan/jdk1.7.0_45
export PATH=$HOME/bin:$JAVA_HOME/bin:$PATH

Execute .bashrc 
$ source .bashrc
—————————————————————————————————–

Solr Server check:
$ cd solr-4.10.3/example
$ java -jar start.jar
 Browser : localhost:8983/solr

—————————————————————————————————–
Add Core in Solr

$ cd solr-4.10.3/example/solr
$ mkdir patient (Core Name)
$ cd patient
$ mkdir conf (Configuration Dir)
$ mkdir data (Index storage Dir)

$ vi core.properties
config=solrconfig.xml
name=patient
schema=schema.xml
dataDir=data

$ cd conf
$ cp /home/saravanan/solr-4.10.3/example/solr/collection1/conf/solrconfig.xml /home/saravanan/solr-4.10.3/example/solr/patient/conf/solrconfig.xml

$ vi schema.xml
<?xml version=”1.0″ encoding=”UTF-8″ ?>
<schema name=”example” version=”1.5″>
<fields>
<field name=”id” type=”int” indexed=”true” stored=”true” required=”true” />
<field name=”name” type=”string” indexed=”true” stored=”true” required=”true” />
<field name=”drug” type=”string” indexed=”true” stored=”true” required=”true” />
<field name=”gender” type=”string” indexed=”false” stored=”true” required=”true” />
<field name=”amt” type=”int” indexed=”true” stored=”true” required=”true” />
<dynamicField name=”*_i” type=”int” indexed=”true”  stored=”true”/>
<dynamicField name=”*_s” type=”string” indexed=”true”  stored=”true”/>
<field name=”_version_” type=”long” indexed=”true” stored=”true”/>
</fields>
<uniqueKey>id</uniqueKey>
<defaultSearchField>name</defaultSearchField>
<types>
<fieldType name=”int” precisionStep=”0″ omitNorms=”true” positionIncrementGap=”0″/>
<fieldType name=”string” sortMissingLast=”true”/>
<fieldType name=”long” precisionStep=”0″ positionIncrementGap=”0″/>
</types>
</schema>
Stop If, already running Solr (Just Press ctrl + c in Terminal)

Start Solr Server

$ cd solr-4.10.3/example
$ java -jar start.jar
Browser : localhost:8983/solr Check your Dashboard (Solr Path and JAVA – Version)

Solr Indexing :
Click core selector (Drop Down Box)

Add the Document of Solr:
Select patient core
Check Menus and Click Documents Default as Json Data. And copy the below sample json sample data and put it in the data box then submit it.

{“pid”:1,
“pname”:”saravanan”,
“drug”:”avil”,
“gender”:”male”,
“amt”:100}

Indexing Query:
Click the queries option and give some queries in it (eg: *:*) and click the Execute Query Button. You can find the output on your screen. Now you can Play with solr indexing.

———————————-

Article written by DataDotz Team

DataDotz is a Chennai based BigData Team primarily focussed on consulting and training on technologies such as Apache Hadoop, Apache Spark , NoSQL(HBase, Cassandra, MongoDB), Search and Cloud Computing.

Note: DataDotz also provides classroom based Apache Kafka training in Chennai. The Course includes Cassandra , MongoDB, Scala and Apache Spark Training. For more details related to Apache Spark training in Chennai, please visit http://datadotz.com/training/