Bit record--ubuntu 14.04 in SOLR and Tomcat integrated installation

Source: Internet
Author: User
Tags curl solr

Reprint please indicate source: http://blog.csdn.net/cywosp/article/details/38965981

1. Installing Jdk,tomcatsudo apt-get install tomcat7 openjdk-7-jdk openjdk-7-jre
2. Download the latest SOLR to http://lucene.apache.org/solr/. Be careful not to go down to the source code packagesolr-4.9.0.tgz sudo mv solr-4.9.0.tgz/mnt cd/mnt && sudo tar-xvf solr-4.9.0.tgz sudo cp-r solr-4.9.0/ Dist/solr-4.9.0.war/var/lib/tomcat7/webapps/sudo cp-r solr-4.9.0/example/solr/mnt/cd/mnt/solr sudo mkdir da Ta sudo chmod a+w data sudo vim collection1/conf/solrconfig.xml will <dataDir>${solr.data.dir:}</dataDir> Change to <dataDir>${solr.data.dir:/mnt/solr/data}</dataDir>
sudo cp-r/mnt/solr-4.9.0/example/lib/ext/*/usr/share/tomcat7/lib/sudo cp-r/mnt/solr-4.9.0/example/resources/log4 j.properties/usr/share/tomcat7/lib/
sudo vim/etc/tomcat7/catalina/localhost/solr.xml added such as the following <?xml version= "1.0" encoding= "UTF-8"?

>

<context docbase= "/var/lib/tomcat7/webapps/solr.war" debug= "0" crosscontext= "true" > <environment name= "so Lr/home "type=" java.lang.String "value="/mnt/solr/data "override=" true "/> </Context>
Service TOMCAT7 Restart after a normal restart, a SOLR folder change is added under the/var/lib/tomcat7/webapps folder/var/lib/tomcat7/webapps/solr/web-inf/ Web. XML will <!--<env-entry> <env-entry-name>solr/home</env-entry-name> <env-entry-va Lue>/put/your/solr/home/here</env-entry-value> <env-entry-type>java.lang.string</ Env-entry-type> </env-entry> Change to <env-entry> <env-entry-name>solr/home</env -entry-name> <env-entry-value>/mnt/solr</env-entry-value> <env-entry-type>java.lang.strin G</env-entry-type> </env-entry>
Service TOMCAT7 Restart
Enter 127.0.0.1:8080/SOLR in the browser and it's OK.
Add Chinese word breaker1. ToHTTPS://GITHUB.COM/CHENLB/MMSEG4J-SOLR Click the link in the download to go toDownloadMmseg4j-solr-2.2.0-with-mmseg4j-core.zip2. Sudo mvMmseg4j-solr-2.2.0-with-mmseg4j-core.zip/mnt/3. sudo unzipMmseg4j-solr-2.2.0-with-mmseg4j-core.zip4. sudo mv Mmseg4j-*.jar &NBSP;/VAR/LIB/TOMCAT7/WEBAPPS/SOLR/WEB-INF/LIB/5. Readme.md include the following in the types node of the    /mnt/solr/collection1/conf/schema.xml file (at the end of the file and before </schema>)     <fieldtype name= "Textcomplex" class= "SOLR. TextField ">      <analyzer>        <tokenizer class=" Com.chenlb.mmseg4j.solr.MMSegTokenizerFactory "mode=" complex "dicdata-path=" dic "/>      </ analyzer>    </fieldType>    <fieldtype name= "Textmaxword" class= "SOLR. TextField ">        <analyzer>          <tokenizer class=" com.ch Enlb.mmseg4j.solr.MMSegTokenizerFactory "mode=" Max-word "dicdata-path=" dic "/>        </ analyzer>      </fieldType>    <fieldtype name= "textsimple" class= "SOLR. TextField ">      <analyzer>        <tokenizer class="Com.chenlb.mmseg4j.solr.MMSegTokenizerFactory" mode= "simple" dicdata-path= "dic"/>      </ analyzer>    </fieldType>
6. Then sudo mkdir/mnt/solr/dic7. Service tomcat7 Restart browser input 127.0.0.1:8080/SOLR OK
8. Use the Curl command to upload the data the current folder has a Software.doc file that creates an index of curl "http://localhost:8080/solr/update/extract?literal.id=doc1& Commit=true "-F" [email protected] "curl" http://localhost:8080/solr/update/extract?literal.id=/mnt/WorkStation/ Software.doc&commit=true "-F" [email Protected]/mnt/workstation/software.doc]
The following is a/mnt/workstation/test.txt file that contains
Dawn Spring Sleep don't feel xiao, everywhere smell cry bird. The night comes the wind and rain, the flowers fall to know how much.

Create index for it curl "http://localhost:8983/solr/update/extract?literal.id=/mnt/WorkStation/test.txt&commit=true"-F "[ Email protected]/mnt/workstation/test.txt "Then query the results in the browser such as the following

Chinese participle

Warning HandlingSolrresourceloader Can ' t find (or read) directory to add to ClassLoader:. /.. /.. /contrib/extraction/lib This problem occurs if the corresponding file cannot be found. Handling: Copy the corresponding library to the past sudo cp-r/mnt/solr-4.9.0/contrib/mnt/solr/sudo cp-r/mnt/solr-4.9.0/dist/mnt/solr/then change/mnt/ Workstation/solr/solr/collection1/conf/schema.xml. Change the corresponding path to your path (you can use an absolute path). The previous step has copied the corresponding folder to/MNT/SOLR, so here's the following path <!--<lib dir= ". /.. /.. /contrib/extraction/lib "regex=". *\.jar "/> <lib dir=". /.. /.. /dist/"regex=" Solr-cell-\d.*\.jar "/>
<lib dir= ". /.. /.. /contrib/clustering/lib/"regex=". *\.jar "/> <lib dir=". /.. /.. /dist/"regex=" Solr-clustering-\d.*\.jar "/>
<lib dir= ". /.. /.. /contrib/langid/lib/"regex=". *\.jar "/> <lib dir=". /.. /.. /dist/"regex=" Solr-langid-\d.*\.jar "/>
<lib dir= ". /.. /.. /contrib/velocity/lib "regex=". *\.jar "/> <lib dir=". /.. /.. /dist/"regex=" Solr-velocity-\d.*\.jar "/>-->
<lib dir= ". /contrib/extraction/lib "regex=". *\.jar "/> <lib dir=". /dist/"regex=" Solr-cell-\d.*\.jar "/>
<lib dir= ". /contrib/clustering/lib/"regex=". *\.jar "/> <lib dir=". /dist/"regex=" Solr-clustering-\d.*\.jar "/>
<lib dir= ". /contrib/langid/lib/"regex=". *\.jar "/> <lib dir=". /dist/"regex=" Solr-langid-\d.*\.jar "/>
<lib dir= ". /contrib/velocity/lib "regex=". *\.jar "/> <lib dir=". /dist/"regex=" Solr-velocity-\d.*\.jar "/>
Error HandlingThe following problems may occur when indexing PDFs or other files, and the main cause of these problems is the corresponding jar files not found SimplePostTool:WARNING:Response: <?

XML version= "1.0" encoding= "UTF-8"?>

<response><lst name= "error" ><str name= "msg" >lazy loading error</str><str name= "Trace" >org.apache.solr.common.solrexception:lazy Loading Error at org.apache.solr.core.requesthandlers$ Lazyrequesthandlerwrapper.getwrappedhandler (requesthandlers.java:257)  at Org.apache.solr.core.requesthandlers$lazyrequesthandlerwrapper.handlerequest (RequestHandlers.java:239)  at Org.apache.solr.core.SolrCore.execute (solrcore.java:1962)  at Org.apache.solr.servlet.SolrDispatchFilter.execute (solrdispatchfilter.java:777)  at Org.apache.solr.servlet.SolrDispatchFilter.doFilter (solrdispatchfilter.java:418)  at Org.apache.solr.servlet.SolrDispatchFilter.doFilter (solrdispatchfilter.java:207)  at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:241)  at Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:208)  at Org.apache.catalina.core.StandardWrapperValve.invoke (Standardwrappervalve.java:220)  at Org.apache.catalina.core.StandardContextValve.invoke ( standardcontextvalve.java:122)  at Org.apache.catalina.core.StandardHostValve.invoke (Standardhostvalve.java :  at Org.apache.catalina.valves.ErrorReportValve.invoke (errorreportvalve.java:98)  at Org.apache.catalina.valves.AccessLogValve.invoke (accesslogvalve.java:950)  at Org.apache.catalina.core.StandardEngineValve.invoke (standardenginevalve.java:116)  at Org.apache.catalina.connector.CoyoteAdapter.service (coyoteadapter.java:408)  at Org.apache.coyote.http11.AbstractHttp11Processor.process (abstracthttp11processor.java:1040)  at Org.apache.coyote.abstractprotocol$abstractconnectionhandler.process (abstractprotocol.java:607)  at Org.apache.tomcat.util.net.jioendpoint$socketprocessor.run (jioendpoint.java:313)  at Java.util.concurrent.ThreadPoolExecutor.runWorker (threadpoolexecutor.java:1145)  at Java.util.concurrent.threadpoolexecutor$worker.run (threadpoolexecutor.java:615)  at Java.lang.Thread.run (thread.java:744) caused by:org.apache.solr.common.SolrException:Error Loading class ' Solr.extraction.ExtractingRequestHandler '  at Org.apache.solr.core.SolrResourceLoader.findClass (solrresourceloader.java:490)  at Org.apache.solr.core.SolrResourceLoader.findClass (solrresourceloader.java:421)  at Org.apache.solr.core.SolrCore.createInstance (solrcore.java:540)  at Org.apache.solr.core.SolrCore.createRequestHandler (solrcore.java:613)  at Org.apache.solr.core.requesthandlers$lazyrequesthandlerwrapper.getwrappedhandler (RequestHandlers.java:248) &NBSP, ..... Morecaused By:java.lang.classnotfoundexception:solr.extraction.extractingrequesthandler at Java.net.urlclassloader$1.run (urlclassloader.java:366)  at Java.net.urlclassloader$1.run ( urlclassloader.java:355)  at java.security.AccessController.doPrivileged (Native Method)  at Java.net.URLClassLoader.findClass (urlclassloader.java:354)  at java.lang.ClassLoadEr.loadclass (classloader.java:425)  at Java.net.FactoryURLClassLoader.loadClass (urlclassloader.java:789)  at Java.lang.ClassLoader.loadClass (classloader.java:358)  at JAVA.LANG.CLASS.FORNAME0 (Native Method)  at java.lang.Class.forName (class.java:270)  at Org.apache.solr.core.SolrResourceLoader.findClass ( solrresourceloader.java:474)   More</str><int name= "Code" >500</int></lst></response>
The workaround is to copy the appropriate jar files into the SOLR server folder sudo cp-r/mnt/solr-4.9.0/contrib/extraction/lib/*/var/lib/tomcat7/webapps/solr/ web-inf/lib/reboot, TOMCAT7 is OK.





Bit record--ubuntu 14.04 in SOLR and Tomcat integrated installation

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.