Linux Installation Standalone SOLR

Source: Internet
Author: User
Tags solr log4j

Objective:

1 SOLR is a severlet, processing data only

2 Tomcat is an environment that runs Serverlet, which is a serverlet container

That's probably what it means: One access request comes in, the Tomcat is first reached, then Tomcat turns the request into a requested object, and SOLR processes the request with its own search engine and returns the data.

3 SOLR is an enterprise-class search server based on the Lucene Java library. Includes Xml/http, JSON API, highlight query results, faceted search, cache, copy, Web admin interface. Here are some of the differences with Lucene.

Lucene is essentially a search base, not a standalone application; SOLR is a standalone application

Lucene focuses on the search for the underlying building; SOLR focuses on enterprise applications

Lucene is not responsible for the management of the job Title Search service; SOLR is responsible for

This is the main installation process, first of all thanks to the help of colleagues Shj, O (∩_∩) o~

Another: The text may have I understand the wrong place, also please feel free, thank you!

Operating system: 64-bit CentOS 5.5 (also ok for colleagues with Ubuntu)

1 JDK Installation

This is nothing to say, to the official Web download JDK and installed, and configure the Java_home, Classpath and so on. Currently I am using jdk-8u45-linux-x64.tar.gz, installed after the configuration of the profile information as follows:

# vim/etc/profilejava_home=/usr/local/jdk CLASSPATH=.: $JAVA _home/jre/lib/rt.jar: $JAVA _home/lib /dt.jar: $JAVA _home/lib/tools.jar PATH= $PATH: $JAVA _home/bin

2 Tomcat Installation

To the official website to download the latest version is good, the latest version is 8.0.21, there are many options below, choose a binary package core under the tar.gz download.

tar -zxv-f apache-tomcat-8.0. . tar. gz-c/usr/mv /usr/local/apache-tomcat-8.0.  /usr/local//usr/local/tomcat/chmod +x *. SH

The Tomcat/bin directory can be added to the environment variable path.

# vim/etc/profilejava_home=/usr/local/jdk CLASSPATH=.: $JAVA _home/jre/lib/rt.jar: $JAVA _home/lib /dt.jar: $JAVA _home/lib/tools.jar tomcat_home=/usr/local/tomcatpath= $PATH: $JAVA _home/bin:$ Tomcat_home/bin

You can then start Tomcat to see if it's installed.

# Catalina. sh start  //  start Tomcat, run Tomcat # Catalina in the background.  SH Stop   //  stop Tomcat# Catalina.  SH run    //  start Tomcat, front run tomcat, can be used directly with CTRL + C termination //  You can also use the following script to run and terminate Tomcat# startup. SH        // start Tomcat# shutdown. SH       // Stop Tomcat

You can use the local ip:8080 or localhost:8080 to see if Tomcat has been successfully installed, and if you see a cat, then OK.

If not, you can go to Tomcat/logs/catalina.2015-04-28.log or use catalina.sh run to view the relevant error messages.

3 SOLR Installation

Similarly, find the latest version on the official web download one, the current version is 5.1.0, I downloaded the solr-5.1.0-src.tgz. Unzip the downloaded tgz file:

tar -zxv-f solr-5.1. 0. tgz

After decompression to find the need for a Solr.war package, this is actually the equivalent of SOLR a Java compression package, when put into Tomcat WebApps after running Tomcat will automatically extract a folder with the same name, that is, we want to serverlet, there is a part of the dependency package also need from SOLR -5.1.0.tgz in this compact package.

Each version of the war package has a different placement path, so it can be found first and then moved to Tomcat/webapps:

# cd/usr/local/src/solr-5.1. 0  Find -name *. War. /server/webapps/cp ./server/webapps/solr.war/usr/local/tomcat/webapps/

Then run Tomcat and you'll see a more Solr folder under the Tomcat/webapps path. After you stop Tomcat, delete Solr.war, or the Solr.war will be decompressed once every time you start Tomcat.

A. Changing the master configuration file

In the Tomcat/webapps/solr/web-inf path is placed on the SOLR of this serverlet all the configuration files, into the inside, you can see the main configuration file Web. XML, you need to configure Solr/home path, This path is the path of the index that you want to use later, you can create a folder under the specified path, and store it in the/usr/local folder.

mkdir /usr/local//usr/local/tomcat/webapps/solr/web-inf# vim web .... <env-entry>    <env-entry-name>sold/home</env-entry-name>    <env-entry-value>/usr/local/solr</env-entry-value>    <env -entry-type>java.lang.string</env-entry-type></env-entry> .... 

The middle red bold place is need to modify the place, this section in the original configuration file is actually exist, but is commented out.

B. Adding a dependency package

Some of the jar packages that SOLR relies on are not directly in the tomcat/webapps/solr/web-inf/lib and need to be copied from the solr-5.1.0 package.

# cd/usr/local/src/solr-5.1.0//The ext file is a necessary dependency package#Find-name ext./server/lib/ext#ls./server/lib/EXTJCL-over-slf4j-1.7.7. Jar jul-to-slf4j-1.7.7. Jar log4j-1.2. -. Jar slf4j-api-1.7.7. Jar slf4j-log4j12-1.7.7. jar#CP./server/lib/ext/*/usr/local/tomcat/webapps/solr/web-inf/lib

When I started Tomcat on my native installation, I reported a bug about Dataimporthandler, so now put the DataImport jar package in Web-inf/lib, which may be used in SOLR's own example.

Find -name *dataimport*cp dist/solr-dataimporthandler-5.1. 0. jar/usr/local/tomcat/webapps/solr/web-inf/lib/CP dist/ solr-dataimporthandler-extras-5.1. 0. jar/usr/local/tomcat/webapps/solr/web-inf/lib/

C. Logs

The SOLR version that is currently in use does not itself provide the class storage path under Web-inf, and once created, you can add a log profile to that path:

# cd/usr/local/tomcat/webapps/solr/web-inf/ # lib  weblogic.xml  mkdir

Then go to solr-5.1.0 to find a name called log4j file, with the first found, put under the classes path:

# cd/usr/local/src/solr-5.1. 0  Find -name *log4j*CP server/resources/log4j.properties/usr/local/tomcat/ webapps/solr/web-inf/classes/

Would have been casually looking for a, with a example called log4j.properties, the results of a path-related error, open this file, see the top two lines have configured a path information, change to a path should be OK, no measurement.

D. Index Storage

The index file used by the SOLR search engine is best placed in a single path, this is in the first section: <a. Change the path of the solr/home configured in Master profile >, in this case,/USR/LOCAL/SOLR.

There are several cores in SOLR-5.1.0/EXAMPLE/EXAMPLE-DIH/SOLR, each of which is a core in SOLR (I understand this is a salutation), and each core has its own configuration file (under the Conf path) and a core.properties. Copy all the files under the SOLR-5.1.0/EXAMPLE/EXAMPLE-DIH/SOLR to the/USR/LOCAL/SOLR.

CP -r/usr/local/src/solr-5.1. 0/EXAMPLE/EXAMPLE-DIH/SOLR/*  /usr/local/solr/

By the way:

Schema.xml and Solrconfig.xml are primarily required under the Conf path.

Schema.xml each field of the primary configuration index

Solrconfig.xml main configuration of each RequestHandler

Even if you complete the installation of a standalone SOLR, run Tomcat, and then open the native IP:8080/SOLR or LOCALHOST:8080:/SOLR with a browser, you can see the SOLR Web interface:

You can see that the core selector in the left core is/USR/LOCAL/SOLR.

Something: If you feel that it is helpful to you, please point to the bottom right corner of the recommendation yo ~ this girl here to thank ~o (∩_∩) O Thank you ~

Linux Installation Standalone SOLR

Related Article

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.