LUCENE/SOLR Search Engine Development Series-2nd. SOLR Installation and Deployment (Tomcat chapter)

Source: Internet
Author: User
Tags solr

First, installation environment

Figure 1-1 Tomcat and SOLR versions

I am currently using the Java version of JDK 1.8 because SOLR 4.9 requires a Java version of 1.7 +, please note.

Ii. SOLR deployment to the Tomcat process

Figure 1-2 Tomcat installation directory

1, 1-2, for the directory of Tomcat decompression;

Figure 1-3 Tomcat Home

2, in the directory E:\apache-tomcat-8.0.9\bin, locate the Startup.bat file, double-click the file, start the Tomcat server, wait a few seconds, enter the HTTP in the browser ://localhost:8080/, if the server is started normally, the interface shown in 1-3 will appear;

3. In E:\apache-tomcat-8.0.9\conf\server.xml, find <Connector> tag, add uriencoding= "UTF-8" at the end of the tag, Purpose to solve the Chinese search garbled, as shown in the following code:

<port= "8080"  protocol= "http/1.1"connectiontimeout  = "20000"redirectport= "8443"  uriencoding= "UTF-8" />

Figure 1-4 Solr-4.9.1.war Copy and paste to the current directory, renamed to Solr.war

Figure 1-5 Tomcat's WebApps directory

4. Copy the Solr.war file in directory E:\solr-4.9.1\dist to E:\apache-tomcat-8.0.9\webapps, as we have previously started the Tomcat server , so Solr.war will automatically extract the Solr folder, as shown in 1-5;

Figure 1-6 Key File replication

5. Close the Tomcat server (that is, close the command line interface that Startup.bat started), create a new folder Solr_home in the E:\apache-tomcat-8.0.9\webapps directory, The folders Collection1 and Solr.xml in the E:\SOLR-4.9.1\EXAMPLE\SOLR are then copied to the E:\apache-tomcat-8.0.9\webapps\solr_home directory;

Figure 1-7 Configuration file Modification Solr_home

6, open the file E:\apache-tomcat-8.0.9\webapps\solr\WEB-INF\web.xml, find <env-entry> tags, modify the code section as shown in 1-7;

Figure 1-8 Static Firstsearcher warming in Solrconfig.xml---> *. *

7, open E:\apache-tomcat-8.0.9\webapps\solr_home\collection1\conf\solrconfig.xml, will <listener Event= "Firstsearcher" class= "SOLR. Querysenderlistener "> Label content as shown in Figure 1-8 to modify;

Figure 1-9 Replication of key directories

8. Copy the Contrib folder and Dist folder in E:\solr-4.9.1 to E:\apache-tomcat-8.0.9;

Figure 1-10 Configuring the SOLR log module

9. Copy the 5 jar packages under E:\solr-4.9.1\example\lib\ext to E:\apache-tomcat-8.0.9\webapps\solr\WEB-INF\lib;

Figure 1-11 Configuring the log output path to the Tomcat logs folder

10. Create a new Classes folder in the E:\apache-tomcat-8.0.9\webapps\solr\WEB-INF folder and copy the E:\solr-4.9.1\example\ Resources\log4j.properties file to the Classes folder, modify the Log4j.properties file, and modify the value of "Log4j.appender.file.File" to ". /logs/solr.log ";

Figure 1-12 SOLR running successfully in Tomcat

11. Delete the Solr.war file under the E:\apache-tomcat-8.0.9\webapps folder, restart Tomcat, enter the http://localhost:8080 in the browser /SOLR, the interface shown in 1-12 shows that SOLR has been successfully configured in Tomcat;

Iii. Summary of this chapter

through the previous article "LUCENE/SOLR Search engine Development Series-1th chapter SOLR Installation and Deployment (jetty)", we know that the jetty server is SOLR's default server, Just unzip the SOLR, start the jetty server, and enter http://localhost:8983/solr/in the browser to run the SOLR backend.

Why should we be so laborious to configure SOLR in Tomcat? There are several reasons for this:

1, after years of development, the general Enterprise uses Tomcat as the development and deployment environment;

2, the program staff of Tomcat familiarity, than Jetty is much higher, when Tomcat problems, also easy to solve;

3, the majority of Java Web Development video, are based on the development of Tomcat to explain, a wide range of communication;

Notice of reprint:

Please respect my intellectual property rights and labor results, this article can be freely reproduced, please specify the source:
Blog URL: http: //www.cnblogs.com/zs8861/

Contact Email: [email protected]

Welcome to the Exchange!

LUCENE/SOLR Search Engine Development Series-2nd. SOLR Installation and Deployment (Tomcat chapter)

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.