in Windows 7 Solr installation configuration under Tomcat
BecaSol is based on java development, so Solr can be deployed in windows and Linux, but Solr provides some for testing, management and maintenance. Shell scripts, so it is recommended to install on Linux during production deployment, and can be used in windows during testing.
Solr is a Lucene-based Java search engine server. Solr provides level search, hits eye-catching displays, and supports 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 index created by Solr is fully compatible with the Lucene search engine library. By properly configuring Solr, in some cases it may be necessary to code, and Solr can read and use indexes built into other Lucene applications. In addition, many Lucene tools (such as Nutch, Luke) can also use the index 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< Br> Tomcat and JDk installation is skipped here.
Note: Solr4.9 requires jdk1.7+
Step 1:
Unzip solr-4.9.0 to any folder, I extract it to D: Installed Applicationssolr-4.9.0solr-4.9.0 directory .
Step 2:
Copy solr-4.9.0dist solr-4.9.0.war to the Tomcat webapp/directory, preferably renamed to solr.war.
Step 3:
Start Tomcat, will report an error, this step is just to decompress solr-4.9.0.war, so manual decompression is also feasible under the webapp directory.
Step 4:
Method 1:
Open webappssolrWEB-INFweb.xml
Find:
This 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 step 1 decompression directory, here you need to pay attention: in the Tutorial of the Solr official website has the following paragraph:
How Solr Works with Tomcat
The two basic steps for Running Solr in 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 be placed into a special directory of the application container. Case of Tomcat, you need to place the Solr WAR file in Tomcat"s webapps directory. If you installed Tomcat with Solr, take a look in tomcat/webapps:you"ll see 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 to get this done. One of the best is to define the solr.solr.home Java system property. With Tomcat, the best way to do this is via a shell environment variable, JAVA_OPTS. Tomcat puts the value of this variable on the command line upon startup
From here it can be seen that the directory pointed to needs to contain conf /solrconfig.xml and conf/schema.xml these two files, which means that there is a need to have a conf subdirectory in the directory pointed to, I just because of the explanation of the official website, did not succeed for a long time, in fact, I understand Wrong, I think there must be a subdirectory conf in the solr.solr.home directory, which contains solrconfig.xml and schema.xml. But in fact, the conf directory is placed under the collection1 directory, the collection is an instance of solr Instance, solr can be configured with multiple collections, you can have a separate configuration file.
My web.xml configuration is:
solr/homeD:/Installed Applications/solr-4.9.0/solr-4.9.0/examplejava.lang.String
Special need to pay attention to the configuration inside The backslash "/", instead of the default "" under windows.
Here I am pointing directly to the example folder.
Method 2 (personal recommendation):
Create a new solr.xml file in the $TOMCAT_HOME/conf/Catalina/localhost directory. The content is:
Note here, override needs to be set to false, otherwise Start tomcat will re-decompress the war file to overwrite the previous configuration, or manually decompress, point the context path directly to the folder
Step 5:
Copy the collection1 directory under the solr-4.9.0examplesolr directory to solr- 4.9.0 in the example directory. The reader can customize the path, defined in web.xml, and the directory pointed to contains the collection1 directory.
Step 6:
Copy the jar package in the D:Installed Applicationssolr-4.9.0solr-4.9.0examplelibext directory to the apache-tomcat-8.0.9lib directory, or copy it to webappssolrWEB-INFlib. Choose your own (global and local issues only). (If you start or report an error, you can find the corresponding jar package in solr-4.9.0dist according to the prompt).
Step 7:
Open the server.xml in the Tomcat conf directory, find the following code to add URIEncoding="UTF-8", add Chinese support.
connectionTimeout="20000"
redirectPort="8443"
URIEncoding="UTF-8" />
Step 8:
Start Tomcat, open the browser and enter: http ://localhost:8080/solr/admin/, see the startup screen, the installation is successful.
The above installation steps can be seen, step four is the core step, which needs to understand the operating principle of Solr: Solr is a service similar to the Http interface, it needs Deployed in the web container (here Tomcat), after running, the application interacts with Solr in the form of an Http request, including adding indexes, queries, and so on. So we need to deploy Solr in the web container and specify the directory where Solr is configured in the Tomcat configuration.
The installation method under Linux is not much different from Windows.