Thursday, August 19, 2010

How to deploy Solr on Tomcat

  • Step 2 : Make a folder somewhere in your computer and name it 'solr_home' (it can have any name). I assume that you have made a folder with the path : C:\ solr-home.
  • Step 3 : Copy the following folders to you solr-home directory which you made in the last step. 
    1. apache-solr-x.x.x/example/lib
    2. apache-solr-x.x.x/example/solr/conf
    3. apache-solr-x.x.x/example/solr/bin
  • Step 4 : Copy the war file placed in the ./apache-solr-x.x.x/dist folder which has a name like apache-solr-x.x.x.war (where x.x.x is the version of your solr core) and paste it in your tomcat webapps directory. 
  • Step 5 : Rename the file 'solr-x.x.x.war'  to solr.zip.
  • Step 6 : Now you have to set the Solr home page in order to tell tomcat where to save your indexes.  The first way to approach this aim is to open the web.xml file in Notepad located in the Solr.zip/WEB-INF directory. Find the <env-entry> element (it should be commented by default). Copy it whole and paste it to the bottom of your xml doc. something like :
<env-entry>
<env-entry-name>solr/home</env-entry-name>
<env-entry-value>C:\ solr-home</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry> .
Also you can set the solr home directory in tomcat configuration panel. To do that , right-click on the icon of tomcat in the notification area , select configure,  go to the  java tab, add the following line to the java options :
-Dsolr.solrhome=C:\solr-home

1 comment: