Apache Solr – Open Source Enterprise Search Platform – Installation

               In this post, we will discuss the Apache Solr installation using tomcat web container. In this article, we are using Apache Solr 4.2.1 version. By the time you read this article, if the latest version is available, you can use the same.

To get started with installation, follow the below steps.Apache Solr

Step 1: Download the Apache Solr from the given link(http://www.apache.org/dyn/closer.cgi/lucene/solr/4.2.1 ) and extract the zip folder. After unzipping the folder, we can see the below folder structure.        

Solr_Folder_StructureStep 2: Download the Apache Tomcat from the given link(http://tomcat.apache.org/download-70.cgi).

Step 3: From the “dist” folder, copy “solr-4.2.1.war” to tomcat “web apps” directory and rename “ solr-4.2.1.war” to “ solr.war”

Step 4: Now, we need to create “SOLR HOME”.The Solr home contains all the configuration files related to our search setup. To create “SOLR HOME”, create a folder with any name in your local file system. In this example, I have created a folder as “solr_home”. The directory structure under “solr_home” is given below.

             solr_home1

Here,”sampleCatalog” is the Solr core name. The core is configured in “solr.xml”. The configuration from the solr.xml is given below.












Step 5: The folder structure under “sampleCatalog” core is given below.

 solr_home2

 

Here, the purpose of each directory is given below.

conf → contains all the configuration files

data → contains the index files

lib → contains all the libraries. All the libraries which will be available under the lib folder will be in classpath.

Step 6: Copy solr-core-4.2.1.jar,solr-dataimporthandler-4.2.1.jar and solr-dataimporthandler-extras-4.2.1.jar files from the “dist” directory( see step 1) to the lib directory of Solr home(see step 5).

Step 7: The files under “conf” folder are given below(Copy the below files from example/example-DIH/solr/solr/conf) folder which we have in Step 1).

        solr_home3

Here, we need to concentrate on db-data-config.xml,schema.xml and solrconfig.xml files. We will talk more about these files in the coming post.

Step 8: Now, configure Solr home environment variable under tomcat configuration file called “context.xml” by adding the below line.

<Environment name="solr/home" type="java.lang.String" value="" override="true" />

Step 9: Start the tomcat container and issue the request <http>://<hostname >:<port>/solr. If the configuration is done properly, you are able to see the below response.

Solr Admin

Now, the installation of Solr is done. In the coming post, we will discuss, how to configure data import handler to import the data from the database.

Stay tuned…

Advertisement

Siva Janapati is an Architect with experience in building Cloud Native Microservices architectures, Reactive Systems, Large scale distributed systems, and Serverless Systems. Siva has hands-on in architecture, design, and implementation of scalable systems using Cloud, Java, Go lang, Apache Kafka, Apache Solr, Spring, Spring Boot, Lightbend reactive tech stack, APIGEE edge & on-premise and other open-source, proprietary technologies. Expertise working with and building RESTful, GraphQL APIs. He has successfully delivered multiple applications in retail, telco, and financial services domains. He manages the GitHub(https://github.com/2013techsmarts) where he put the source code of his work related to his blog posts.

Tagged with: ,
Posted in Apache Solr, SolrInstall

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Dzone.com
DZone

DZone MVB

Java Code Geeks
Java Code Geeks
OpenSourceForYou
%d bloggers like this: