[solr]solr的安装

solr是什么?

翻译

SolrTM is the popular, blazing fast open source enterprise search platform from the Apache LuceneTM project. Its major features include powerful full-text search, hit highlighting, faceted search, near real-time indexing, dynamic clustering, database integration, rich document (e.g., Word, PDF) handling, and geospatial search. Solr is highly reliable, scalable and fault tolerant, providing distributed indexing, replication and load-balanced querying, automated failover and recovery, centralized configuration and more. Solr powers the search and navigation features of many of the world's largest internet sites.

Solr is written in Java and runs as a standalone full-text search server within a servlet container such as Jetty. Solr uses the Lucene Java search library at its core for full-text indexing and search, and has REST-like HTTP/XML and JSON APIs that make it easy to use from virtually any programming language. Solr's powerful external configuration allows it to be tailored to almost any type of application without Java coding, and it has an extensive plugin architecture when more advanced customization is required.

See the complete feature list for more details.

solr安装

下载:

http://archive.apache.org/dist/lucene/solr/

最新版本4.6.1

环境需求:

java 1.6版本以上;

solr运行需要java serverlet 容器,默认使用jetty,或者tomcat,jboss等等。

步骤:

1.wget 软件包,wget http://archive.apache.org/dist/lucene/solr/4.6.1/solr-4.6.1.tgz

2.解压, tar zxvf solr-4.6.1.tgz

3.进入到solr-4.6.1/example, 运行java -jar start.jar,这样jetty就监听在8983端口,在浏览器输入ip:8983/solr

side XXXXXXXXX

使用tomcat替代jetty

1.安装好java,安装好tomcat

2.将解压包中的solr-4.6.1/dist/solr-4.6.1.war复制到tomcat_dir/webapps/目录,并命名为solr.war

3.将solr-4.6.1/example/lib/ext/目录下的jar文件复制到tomcat_dir/lib目录下,将solr-4.6.1/example/resources/下的log4j.properties文件复制到tomcat_dir/lib目录下

这一步的目的是解决报错 startInternal SEVERE: Error filterStart,参考http://www.cnblogs.com/hupengcool/archive/2013/05/11/3072573.html

4.修改tomcat_dir/conf/server.xml

    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" 
               URIEncoding="UTF-8" />

5.创建solr.xml,路径:tomcat_dir/conf/Catalina/localhost/solr.xml,内容:

<Context path="/solr" docBase="/home/app/act/tomcat/apache-tomcat-7.0.47/webapps/solr.war"
         debug="0" crossContext="true">
  <Environment name="solr/home" type="java.lang.String" value="/home/app/act/solr/example/solr/" override="true" />
</Context> 

6.下面是添加solr配置文件,这些文件包括schema.xml,solrconfig.xml等等,这些文件放置在solr/home目录下(实际上实在solr/home/collection1下)。

solr-4.6.1/example/solr/下的目录结构是

.
├── bin
├── collection1
│   ├── conf
│   │   ├── admin-extra.html
│   │   ├── admin-extra.menu-bottom.html
│   │   ├── admin-extra.menu-top.html
│   │   ├── clustering
│   │   │   └── carrot2
│   │   │       ├── kmeans-attributes.xml
│   │   │       ├── lingo-attributes.xml
│   │   │       └── stc-attributes.xml
│   │   ├── currency.xml
│   │   ├── elevate.xml
│   │   ├── lang
│   │   │   ├── contractions_ca.txt
│   │   │   ├── contractions_fr.txt
│   │   │   ├── contractions_ga.txt
│   │   │   ├── stopwords_ca.txt
│   │   │   ├── stopwords_cz.txt
│   │   │   ├── stopwords_da.txt
│   │   ├── mapping-FoldToASCII.txt
│   │   ├── mapping-ISOLatin1Accent.txt
│   │   ├── protwords.txt
│   │   ├── schema.xml
│   │   ├── scripts.conf
│   │   ├── solrconfig.xml
│   │   ├── spellings.txt
│   │   ├── stopwords.txt
│   │   ├── synonyms.txt
│   │   ├── update-script.js
│   │   ├── velocity
│   │   │   ├── browse.vm
│   │   │   ├── cluster_results.vm
│   │   │   ├── cluster.vm
│   │   │   ├── debug.vm
│   │   │   └── VM_global_library.vm
│   │   └── xslt
│   │       ├── example_atom.xsl
│   │       ├── example_rss.xsl
│   │       ├── example.xsl
│   │       ├── luke.xsl
│   │       └── updateXml.xsl
│   ├── core.properties
│   ├── data
│   │   ├── index
│   │   │   ├── _0.fdt
│   │   │   ├── _0.fdx
│   │   │   ├── _0.fnm
│   │   │   ├── _0_Lucene41_0.doc
│   │   │   ├── _0_Lucene41_0.pos
│   │   └── tlog
│   │       └── tlog.0000000000000000000
│   └── README.txt
├── README.txt
├── solr.xml
└── zoo.cfg

按照上面可以运行solr。

原文地址:https://www.cnblogs.com/silenceli/p/3555590.html