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.
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.
Step 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.
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.
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).
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.
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…
Leave a Reply