How Windows 7 installs Solr+tomcat

Source: Internet
Author: User
Tags http request requires solr tomcat

Tomcat under SOLR installation configuration

Because SOLR is based on Java development, SOLR is well deployed in both Windows and Linux, but because SOLR provides some shell scripts for testing and managing and maintaining convenience, it is recommended to install Linux on production deployments. Test time can be used in Windows.

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. The indexes created by SOLR are 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.

  Installation Environment

Windows 7 64bit

Apache-tomcat-8.0.9-windows-x64

Solr-4.9.0

JDK 1.8.0_05 64bit

Installation steps

The tomcat and JDK installations are skipped over here.

Note: solr4.9 requires jdk1.7+

  Step One:

Extract solr-4.9.0 to any folder, I extract the d:installed applicationssolr-4.9.0solr-4.9.0 directory.

  Step Two:

Copy the Solr-4.9.0dist Solr-4.9.0.war to the Tomcat webapp/directory, preferably renamed to Solr.war.

  Step Three:

Start Tomcat, will be an error, this step is only to Solr-4.9.0.war decompression, so manual decompression placed under the WebApp directory is also feasible.

  Step Four:

Method One:

Open Webappssolrweb-infweb.xml

Found it:

Here is the need to configure solr/home, only need to modify/put/your/solr/home/here

This directory can be customized, it is recommended to use the steps to extract the directory, here need to be very careful: in the tutorial of SOLR's official website has the following paragraph:

  How SOLR works with Tomcat

The two basic steps for running SOLR into any WEB application container are as follows:

Make the SOLR classes available to the container. In many cases, the SOLR WEB application Archive (WAR) file can is placed into a special directory of the application Conta Iner. In the case of Tomcat, you are need to where the SOLR WAR file in Tomcat's WebApps directory. If you are installed Tomcat with SOLR, take a look in Tomcat/webapps:you ' ll-the Solr.war file is already there.

Point SOLR to the SOLR home directory, that contains Conf/solrconfig.xml and Conf/schema.xml. There are a few ways. One of the best is to define the Solr.solr.home Java system property. With Tomcat, the "best way" is via a shell environment variable, java_opts. Tomcat puts the value of this variable on the command line upon startup

As you can see from here, the directory you point to contains Conf/solrconfig.xml and conf/ Schema.xml These two files, also means that in the directory to point to have a Conf subdirectory, I was because of this interpretation of the official website, did not succeed in the long time, in fact, I understand the wrong, I think in the Solr.solr.home directory must have a subdirectory conf,conf contains SOLRCONFI G.xml and Schema.xml. But in fact the Conf directory is placed under the Collection1 directory, collection is a instance instance of SOLR, SOLR can configure multiple collection, you can have a separate configuration file.

My side. Web.xml configuration is:

Solr/homed:/installed applications/solr-4.9.0/solr-4.9.0/examplejava.lang.string

It is particularly necessary to note that the configuration uses a backslash "/" instead of the default "" in Windows.

Here I am pointing directly to the example folder.

Method two (personal recommendation):

Create a new Solr.xml file in the $tomcat_home/conf/catalina/localhost directory, which reads:

Here, note that override needs to be set to false, otherwise each boot Tomcat will decompress the war file to overwrite the previous configuration, or manually unpack, point the context path directly to the folder

  Step Five:

Copy the Collection1 directory in the SOLR-4.9.0EXAMPLESOLR directory to the Solr-4.9.0example directory as a whole. Readers can customize the path themselves, as defined in Web.xml, and this pointed directory contains the Collection1 directory.

  Step Six:

Will d:installed The Applicationssolr-4.9.0solr-4.9.0examplelibext directory under the JAR package copy to the Apache-tomcat-8.0.9lib directory, can also copy to Webappssolrweb-inflib, the reader can Select (Global and local issues only). (If you start or error, you can follow the prompts to find the appropriate jar package in solr-4.9.0dist).

  Step Seven:

Open the Server.xml in the Tomcat directory and find the following section of code to add uriencoding= "UTF-8" to add Chinese support.

connectiontimeout= "20000"

Redirectport= "8443"

uriencoding= "UTF-8"/>

  Step Eight:

Start Tomcat, open Browser input: http://localhost:8080/solr/admin/, see the splash screen to indicate that the installation was successful.

  Summarize

As you can see from the installation steps above, step four is the most central step, which requires an understanding of how SOLR works: SOLR is a service similar to the HTTP interface that needs to be deployed in the Web container (here is Tomcat), after it is run, The application interacts with SOLR in the form of an HTTP request, including adding indexes, querying, and so on. So we need to deploy SOLR in the Web container and indicate the directory of SOLR configuration in the Tomcat configuration.

The installation method under Linux does not differ greatly from Windows.

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.