---
title: "solr安装"
author: "GhostWolf"
date: "2014-06-30T17:34:18Z"
tags: []
categories: ["开源软件"]
slug: "solr"
draft: false
lastmod: "2014-07-04T17:33:04Z"
id: 2086908
url: "https://ghostwolf.iteye.com/blog/2086908"
---

抽空学了一下solr，走了不少弯路，刚开始用resin3+solr4.9，web.xml一直报错，metadata-complete="true"属性不存在，因为需要升级resin版本，折腾，最后才发现其实在resin3下面只要删除这个属性其实也是可以运行的。

 

以下为简单的安装步骤：

1.复制solr-4.9.0\\example\\webapps\\solr.war，放到服务器上/home/resin/data/jsp/solr/WebRoot（路径自己定义），并解压

2.复制solr-4.9.0\\example\\solr下面所有文件，放到服务器上/home/resin/data/jsp/solr/WebRoot/cores/single(路径自己定义)

3.配置resin host

4.修改web.xml，把&lt;env-entry&gt;&lt;/env-entry&gt;标签的注释去除，修改为自己的路径

            &lt;env-entry&gt;

                  &lt;env-entry-name&gt;solr/home&lt;/env-entry-name&gt;

                  &lt;env-entry-type&gt;java.lang.String&lt;/env-entry-type&gt;

                  &lt;env-entry-value&gt;/home/resin/data/jsp/solr/WebRoot/cores/single&lt;/env-entry-value&gt;

            &lt;/env-entry&gt;

注意这里不修改，会报/solr/collection1/solrconfig.xml was not found on this server

 

至此安装算是完成

 

\------------------------------------------------------------------------------------------------------------------------

以上为单实例，如果需要配置多实例，可以这样配置

1.新建目录/home/resin/data/jsp/solr/WebRoot/cores/multicore(路径自己定义)

2.把solr-4.9.0中\\example\\multicore目录下的文件复制到multicore中

3.修改web.xml，/home/resin/data/jsp/solr/WebRoot/cores/single修改为/home/resin/data/jsp/solr/WebRoot/cores/multicore

 

如果你想通过后台去新建个实例，需要这样配置

1.在/home/resin/data/jsp/solr/WebRoot/cores/multicore目录中新建立new\_core文件夹（名字自己定义）

2.在new\_core中新建conf 和data这两个文件夹

3.在conf文件夹中放入schema.xml、solrconfig.xml 这两个文件（可以从core0\\conf中复制过来）

4.修改/home/resin/data/jsp/solr/WebRoot/cores/multicore/solr.xml文件，&lt;cores&gt;&lt;/cores&gt;中新增&lt;core name="new\_core" instanceDir="new\_core" /&gt;，注意new\_core的名字要和第1步新建的文件夹new\_core名字要一致

 

参考链接：

http://blog.csdn.net/cymlancy/article/details/10504491

http://blog.csdn.net/escaflone/article/details/5726774