Configuring solr5.3 detailed steps in Linux environments

Source: Internet
Author: User

I have just configured the solr5.3 version of CentOS in Friday, the comprehensive reference and improve a number of tutorials, posted as follows

Unit use intranet, this tutorial is not, sorry

In addition, I am using. NET programming call SOLR using Solrnet, here to recommend

Upload the package to the/tmp directory first

Required files are as follows

Jdk-8u60-linux-x64.gz

Apache-tomcat-7.0.64.tar.gz

Solr-5.3.0.tgz

Ik word breaker, pinyin word breaker:

Ikanalyzer-5.0.jar
Solr-analyzer-ik-5.1.0.jar
Pinyin4j-2.5.0.jar
Analyzer-pinyin-lucene-5.1.0.jar
Analyzer-pinyin-solr-5.1.0.jar

IK word breaker requires ext.dic (dictionary) stopword.dic (exclusion word) IKAnalyzer.cfg.xml (config)


One, JDK installation
[Email protected]/]# cd/tmp/
[[email protected]/] #tar ZXVF jdk-8u60-linux-x64.gz
[[email protected]/] #mv jdk1.8.0_60/usr/
[[email protected]/] #vi/etc/profile
In the last line, copy the following code to add this:
java_home=/usr/jdk1.8.0_60/
Classpath=.: $JAVA _home/lib/tools.jar
Path= $JAVA _home/bin: $PATH
Export Java_home CLASSPATH PATH
After you save the exit (: wq!), execute the following command to take effect:
Source/etc/profile


II. TOMCAT Installation
1. Decompression the Tomcat package to the TMP directory:
[Email protected] Tmp]tar ZXVF apache-tomcat-7.0.64.tar.gz
Move the Tomcat package under/usr/local/tomcat:
[Email protected] TMP]MV Apache-tomcat-7.0.64/usr/local/tomcat

2. Modify Tomcat's server configuration, plus Utf-8
[Email protected] Tmp]vim/usr/local/tomcat/conf/server.xml

Added uriencoding= "UTF-8"
<connector port= "protocol=" http/1.1 "
connectiontimeout= "20000"
Redirectport= "8443" uriencoding= "UTF-8"/>

3. Tomcat Plus Account
Vi/usr/local/tomcat/conf/tomcat-users.xml
The penultimate line returns to add the following:
<user username= "admin" password= "admin" roles= "Manage-gui"/>

4. Launch Tomcat and test access
[Email protected] tmp]/usr/local/tomcat/bin/startup.sh
Access localhost:8080/manager/html Input Account Admin Password admin successfully entered

5, need to note that if the firewall port is not open need to open the appropriate port
[Email protected] Tmp]vi/ect/sysconfig/iptables
Add a row of port data to the Iptables and restart Iptables
[[email protected] tmp]service iptables stop
[[email protected] tmp]service iptables start


Iii. installation of SOLR
1. Unzip SOLR
[Email protected] TMP]TAR-ZXVF solr-5.3.0.tgz
2. Move the SOLR package to the OPT directory:
[Email protected] Tmp]mv/tmp/solr-5.3.0/opt/solr
3. Copy the WebApp in Server/solr-webapp to Tomcat WebApps and rename it to SOLR
[Email protected] tmp]cp-r/OPT/SOLR/SERVER/WEBAPPS/WEBAPP/USR/LOCAL/TOMCAT/WEBAPPS/SOLR


4, modify the SOLR home configuration (note: To remove the comments of this paragraph, otherwise does not take effect):
<env-entry>
<env-entry-name>solr/home</env-entry-name>
<env-entry-value>/opt/solr/server/solr</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>

Copy the core of the instance to Solrhome and name it your own (my name is Qdfs)
Cp-r/opt/solr/example/example-dih/solr/solr/opt/solr/server/solr/qdfs


5. Copy the jar package under Solr/server/lib/ext to the web-inf/lib/of Tomcat's SOLR Web:
[Email protected] tmp]cp/opt/solr/example/lib/ext/*.jar/usr/local/tomcat/webapps/solr/web-inf/lib/
Copy the jar of Dist\solrj-lib to Tomcat\lib
cp/opt/solr/dist/solrj-lib/*.jar/usr/local/tomcat/lib/

6. Create the classes under Tomcat SOLR and copy the Example/resources/log4j.properties into the classes:
[Email protected] tmp]mkdir-p/usr/local/tomcat/webapps/solr/web-inf/classes
[Email protected] tmp]cp/opt/solr/server/resources/log4j.properties/usr/local/tomcat/webapps/solr/web-inf/ classes/


Iv. Configuring the instance core (my name Qdfs)
1. Create INDEX folder data
[Email protected] Tmp]mkdir/opt/solr/server/solr/data

2, modify the Solrconfig
[Email protected] Tmp]vi/opt/solr/server/solr/qdfs/conf/solrconfig.xml
Put <lib dir= "{solr.instal.dir ... Comment out. Because it's not using SOLR's own boot
Set Solrdata Address
<dataDir>${solr.data.dir:/opt/solr/server/solr/data}</dataDir>

3, the configuration instance needs the jar package, also may by the configuration previous step solrconfig the Lib node to realize the same function, but the effect is not very stable
[Email protected] tmp]cp/opt/solr/contrib/analysis-extras/lib/*.jar/usr/local/tomcat/webapps/solr/web-inf/lib/

4, modify the schema, configure the field word breaker
[Email protected] Tmp]vi/opt/solr/server/solr/qdfs/conf/schema.xml

Add the IK word breaker configuration to the back of the document
<!--IK word breakers--
<fieldtype name= "Text_ik" class= "SOLR. TextField ">
<analyzer type= "Index" >
<tokenizer class= "Org.apache.lucene.analysis.ik.IKTokenizerFactory" usesmart= "false"/>
<filter class= "Org.apache.lucene.analysis.pinyin.solr5.PinyinTokenFilterFactory" firstchar= "false" Mintermlength= "2"/>
<filter class= "Org.apache.lucene.analysis.pinyin.solr5.PinyinNGramTokenFilterFactory" ngramchinese= "false" Ngramnumber= "false"/>

</analyzer>
<analyzer type= "Query" >
<tokenizer class= "Org.apache.lucene.analysis.ik.IKTokenizerFactory" usesmart= "false"/>
<filter class= "Org.apache.lucene.analysis.pinyin.solr5.PinyinTokenFilterFactory" firstchar= "false" Mintermlength= "2"/>
<filter class= "Org.apache.lucene.analysis.pinyin.solr5.PinyinNGramTokenFilterFactory" ngramchinese= "true" Ngramnumber= "true"/>
</analyzer>
</fieldType>

Configure in the field node
<field name= "Text_ik" type= "Text_ik" indexed= "true" stored= "true"/>


V. IK word breaker configuration
1, the IK word breaker jar copy into the lib,solr5.x version of the normal IK word breaker, pinyin word breaker is not good use, is the benefit of the Great God blog download. Probably need the following jar
Ikanalyzer-5.0.jar
Solr-analyzer-ik-5.1.0.jar
Pinyin4j-2.5.0.jar
Analyzer-pinyin-lucene-5.1.0.jar
Analyzer-pinyin-solr-5.1.0.jar

[Email protected] tmp]cp/tmp/solr_jars/*.jar/usr/local/tomcat/webapps/solr/web-inf/lib/

2, IK word breaker needs ext.dic (dictionary) stopword.dic (exclude word) IKAnalyzer.cfg.xml (configuration) of several files copied into the Solrweb
[Email protected] tmp]mkdir/usr/local/tomcat/webapps/solr/web-inf/classes
Copy the Ext.dic Stopword.dic IKAnalyzer.cfg.xml into the
Edit Ext.dic Comment release in IKAnalyzer.cfg.xml

VI. Testing

Note that the SOLR Web site uses ANGULARJS and requires a browser that supports HTML5 to be accessed normally.

Access to LOCALHOST:8080/SOLR for successful access.

Click Core Admin, click Addcore, enter Name:qdfs, INSTANCEDIR:QDFS, submit data.

Access Ocalhost:8080/solr#/qdfs/analysis, FieldType Select the Text_ik test word effect you just added

Reference Links:

The perfect deployment of SOLR search engine under Linux (CentOS) http://www.linuxidc.com/Linux/2014-03/98024.htm

SOLR5 with the IK word breaker http://iamyida.iteye.com/blog/2220474

With Yida learning Solr5 pinyin participle [improved] http://iamyida.iteye.com/blog/2240657

Configuring solr5.3 detailed steps in Linux environments

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.