SOLR Installation and Configuration

Source: Internet
Author: User
Tags solr
installation and configuration of Solr4.4Category: Java solr 2013-08-10 11:03 2612 people read Comments (8) Favorites Report Java SOLR

Directory (?) [+]

I recently prepared to use SOLR to build the project, so I have some knowledge of it, I am using the Solr4.4 version; This version of SOLR has changed a lot compared to previous versions, and here's how you install and configure yourself.

Many of the online tutorials on SOLR are very old, many tutorials are based on Solr1.3 or 1.4 version in the explanation, some of the content of the contents of the comparison of the current version will be unintelligible.

Read as many official Wiki documents as possible: http://wiki.apache.org/solr/


Introduction to SOLR


Here is a brief introduction to SOLR:

SOLR is a Java search engine server based on Lucene. SOLR provides a level search, hit highlighting, and support for multiple output formats, including XML/XSLT and JSON formats. It is easy to install and configure, and comes with an HTTP-based management interface. SOLR has been used in a number of large web sites, more mature and stable. SOLR wraps and expands Lucene, so SOLR basically follows the relevant terminology of lucene. More importantly, SOLR creates an index that is fully compatible with the Lucene search engine library. With the appropriate configuration of SOLR, some cases may need to be encoded, and SOLR can read and use the indexes built into other Lucene applications. In addition, many Lucene tools (such as Nutch, Luke) can also use the indexes created by SOLR.


Download Decompression


Official website: http://lucene.apache.org/solr/

Download list: http://www.apache.org/dyn/closer.cgi/lucene/solr/4.4.0

Unzip the downloaded Solr-4.4.0.zip compressed package and see the following directory structure:


What is useful to us is the contents of the example and dist directories.


Installation and Configuration


First, unzip the Solr.war package in the Exmaple/webapps into Tomcat's WebApps, or directly copy the Solr.war package directly into Tomcat's WebApps, and then start Tomcat to unzip it and then delete the war package. If you start Tomcat, it will be an error, because we have not set solr_home (that is, the directory where the index and configuration files are located).

The following configuration:

There are several ways to set up the Solr_home, Baidu is OK, here I am using the Web.xml file in SOLR application configuration. Open the Solr/web-inf/web.xml file and find the following:

[HTML] view plain copy <env-entry> <env-entry-name>solr/home</env-entry-name> < Env-entry-value> /webapps/solr/solr_home</env-entry-value> <env-entry-type>java.lang.String</env-entry-type> & Lt;/env-entry>

This content initially is annotated, after the annotation, the <env-entry-value> node content will be changed to a certain location on the disk, I use the relative position, absolute position is certainly also possible.

The configuration is over. You also need to place a folder at the configured path as Solr_home (which is already available in SOLR example), and we copy the EXAMPLE/SOLR directory to the SOLR project directory (this is%tomcat_home%/webapps/ solr/), and rename it to Solr_home (as determined by your own configuration).


Configure log Output


At this point, if you start Tomcat (by invoking the startup.sh script), you still can't start correctly, and the error is only a few lines, as follows:

[Java] view plain copy 2013-8-9 15:49:05 org.apache.catalina.core.StandardContext start serious: Error Filterstart 2013-8-9 15:49:05 org.apache.catalina.core.StandardContext Start severity: Context [/SOLR] startup failed due to previous ER Rors
The error message given is unclear, then if we start TOMCAT in a different way, we will find the error output, and in the command line the current directory to%tomcat_home%/bin, and execute the following command:

[Java] view plain copy Java-jar Bootstrap.jar
This allows you to see the exception information for the command line output as follows (omitting part of the content):

[Java]  View plain copy serious: exception starting filter solrrequestfilter   Org.apache.solr.common.solrexception: could not find necessary slf4j logging  jars. If using Jetty, the SLF4j logging jar   S need  to go in the jetty lib/ext directory. for other containers,  the corresponding directory should be used. For more   information, see: http://wiki.apache.org/solr/solrlogging            at org.apache.solr.servlet.SolrDispatchFilter.<init> (solrdispatchfilter.java:104)            ......            at org.apache.catalina.startup.bootstrap.start (bootstrap.java:289)              at org.apache.catalina.startup.bootstrap.main (bootstrap.java:414)    Caused by:  java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory            at org.apache.solr.servlet.SolrDispatchFilter.<init> (solrdispatchfilter.java:102)            ... 33 more   Caused by:  java.lang.ClassNotFoundException: org.slf4j.LoggerFactory            at org.apache.catalina.loader.webappclassloader.loadclass (WebappClassLoader.java:1680)            at  Org.apache.catalina.loader.WebappClassLoader.loadClass (webappclassloader.java:1526)   

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.