The software and version used in this article:
Build Environment: Windows 7 x64
SOLR: solr-4.8.0
Java SDK: jdk-7u55-windows-x64
Tomcat: apache-tomcat-7.0.53-windows-x64
Step 1: Install the Java SDK
Go to the Java official website and download JDK 7u55. Http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
The downloaded file is jdk-7u55-windows-x64.exe.
Double-click the file to install it. The default installation path is "C: \ Program Files \ Java \ jdk1.7.0 _ 55"
Step 2: install Tomcat
Download Tomcat online. I downloaded Tomcat 7.0.53.
The downloaded file is apache-atat-7.0.53-windows-x64.zip.
Create a new working directory on disk D, and a resume directory named SOLR under the working directory to store Tomcat and collection. Decompress the apache-tomcat-7.0.53-windows-x64.zip file. Copy the entire directory to the SOLR directory of disk D and change the default folder name apache-Tomcat-7.0.53 to Tomcat.
Step 3: Configure Windows Environment Variables
Open the windows environment variables and create the following environment variables.
Catalina_base: D: \ working \ SOLR \ Tomcat
Catalina_home: D: \ working \ SOLR \ Tomcat
Classpath: C: \ Program Files \ Java \ jdk1.7.0 _ 55 \ Lib \ DT. jar; C: \ Program Files \ Java \ jdk1.7.0 _ 55 \ Lib \ tools. Jar
Java_home: C: \ Program Files \ Java \ jdk1.7.0 _ 55
Jre_home: C: \ Program Files \ Java \ jdk1.7.0 _ 55
Modify the PATH environment variable and add the following data (note the preceding comma ):
; C: \ Program Files \ Java \ jdk1.7.0 _ 55 \ bin; C: \ Program Files \ Java \ jdk1.7.0 _ 55 \ JRE \ bin; D: \ working \ SOLR \ Tomcat \ Lib; D: \ working \ SOLR \ Tomcat \ bin
Step 4: Build a SOLR Server
1. Download and extract solr-4.8.0
2. Copy SOLR. war under the example \ webapps directory to the webapps directory of Tomcat (D: \ working \ SOLR \ Tomcat \ webapps ).
3. Start the Tomcat server with the command "Startup". If it cannot be started, check the environment variable settings in step 3. At this time, the program will report an error. You don't need to worry about it for the moment, just to decompress the war package and close tomcat after startup.
4. Create a tomcat-SOLR directory under the SOLR directory of the D Drive working directory.
5. Go to the solr-4.8.0 directory and copy all the files and directories under the example/SOLR directory to the newly created tomcat-SOLR directory.
6. Copy all jar packages under example/lib/EXT/to the lib directory of D: \ working \ SOLR \ Tomcat \ webapps \ SOLR \ WEB-INF. There are 5 jar packages in total, is an independent log processing module of SOLR;
7. Create a new classes directory under tomcat/webapps/SOLR/WEB-INF/(d: \ working \ SOLR \ Tomcat \ webapps \ SOLR \ WEB-INF \ Classes ), set log4j under example/resources. copy the properties file to the classes directory. Otherwise, the log module will not work properly;
8. Find the labels used to configure the environment variables in the D: \ working \ SOLR \ Tomcat \ webapps \ SOLR \ WEB-INF \ Web. xml file, remove the annotations, and modify the environment variables
9. Restart tomcat. No error will be reported. A lot of info log information will be printed, including warn information. This is because solrconfig under collection1. configuration in XML, because I have not configured the above modules of SOLR, so there will be a warning, you can comment out.
10. Enter http: // localhost: 8080/SOLR in the browser to view the SOLR management interface.
Several notes:
1. If IIS uses port 8080, change the tomcat configuration file D: \ SOLR \ Tomcat \ conf \ Server. xml and modify the default port and encoding information.
2. If the collection is enabled, the following error occurs: org. Apache. SOLR. Common. solrexception: Undefined field text.
Add the following section to the schema. xml file in the conf directory of the collection:
<Field name = "text" type = "text_general" stored = "false" indexed = "true"/>
<Defasearchsearchfield> text </defasearchsearchfield>
The following articles will be added later:
1. dataimporthandler of the sqlserver Database
2. How to add a collection in SOLR
3. Implementation of scheduled Indexes.
SOLR server construction Guide