You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2012/02/22 12:47:41 UTC

[Solr Wiki] Update of "SolrTomcat" by GeorgeHarley

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The "SolrTomcat" page has been changed by GeorgeHarley:
http://wiki.apache.org/solr/SolrTomcat?action=diff&rev1=53&rev2=54

Comment:
The $SOLR_HOME needs to include the solr directory under (e.g. /opt/solr/example/solr) otherwise a 404 error occurs when requesting http://<host>:<port>/solr-example/admin/ 

  === Installing Solr instances under Tomcat ===
  Assuming that Solr and its ''example'' are built, this is how to install the Solr example as an instance under Tomcat.  
  
- Copy the ''example/solr'' directory from the source to the installation directory like ''/opt/solr/example'', herafter ''$SOLR_HOME''.  Copy the .war file ''dist/apache-solr-*.war'' into ''$SOLR_HOME'' as ''solr.war''.
+ Copy the ''example/solr'' directory from the source to the installation directory like ''/opt/solr/example/solr'', herafter ''$SOLR_HOME''.  Copy the .war file ''dist/apache-solr-*.war'' into ''$SOLR_HOME'' as ''solr.war''.
  
  The configuration file ''$SOLR_HOME/conf/solrconfig.xml'' in the example sets ''dataDir'' for the index to be ''./solr/data'' relative to the current directory - which is true for running the Jetty server provided with the example, but incorrect for Tomcat running as a service.  Modify the ''dataDir'' to specify the full path to ''$SOLR_HOME/data'':
  
   . {{{
-   <dataDir>${solr.data.dir:/opt/solr/example/data}</dataDir>
+   <dataDir>${solr.data.dir:/opt/solr/example/solr/data}</dataDir>
  }}}
  
  The ''dataDir'' can also be temporarily overridden with the ''JAVA_OPTS'' environment variable prior to starting Tomcat:
  
   . {{{
-   export JAVA_OPTS="$JAVA_OPTS -Dsolr.data.dir=/opt/solr/example/data"
+   export JAVA_OPTS="$JAVA_OPTS -Dsolr.data.dir=/opt/solr/example/solr/data"
  }}}
  
  Create a Tomcat Context fragment to point ''docBase'' to the ''$SOLR_HOME/solr.war'' file and ''solr/home'' to ''$SOLR_HOME'':
  
  {{{
  <?xml version="1.0" encoding="utf-8"?>
- <Context docBase="/opt/solr/example/solr.war" debug="0" crossContext="true">
+ <Context docBase="/opt/solr/example/solr/solr.war" debug="0" crossContext="true">
-   <Environment name="solr/home" type="java.lang.String" value="/opt/solr/example" override="true"/>
+   <Environment name="solr/home" type="java.lang.String" value="/opt/solr/example/solr" override="true"/>
  </Context>
  }}}
  Symlink or place the file in ''$CATALINA_HOME/conf/Catalina/localhost/solr-example.xml'', where Tomcat will automatically pick it up.  Tomcat deletes the file on undeploy (which happens automatically if the configuration is invalid).