抽空學了一下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,把<env-entry></env-entry>標籤的註釋去除,修改爲自己的路徑
<env-entry>
<env-entry-name>solr/home</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>/home/resin/data/jsp/solr/WebRoot/cores/single</env-entry-value>
</env-entry>
注意這裏不修改,會報/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文件,<cores></cores>中新增<core name="new_core" instanceDir="new_core" />,注意new_core的名字要和第1步新建的文件夾new_core名字要一致
參考鏈接:
http://blog.csdn.net/cymlancy/article/details/10504491
http://blog.csdn.net/escaflone/article/details/5726774