一直用lucene,今天开始整理学习solr
安装solr
1.下载:http://www.apache.org/dyn/closer.cgi/lucene/solr/4.4.0
2.下载完成后直接解压至D:\solr-4.4.0
3.将D:\solr-4.4.0\examples下的slor文件夹复制到D:\apache-tomcat-7.0.40下面,作为solr的home目录
4.将D:\solr-4.4.0\examples\webapps下的solr.war复制到tomcat的webapps目录下,war包在tomcat启动后会自动解压出来,打开solr/WEB-INF/web.xml文件,找到如下内容:去掉注释对应修改solr的home目录
<env-entry>
<env-entry-name>solr/home</env-entry-name>
<env-entry-value>D:/apache-tomcat-7.0.40/solr</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
5.配置solr的data目录,打开D:\apache-tomcat-7.0.40\solr\collection1\conf\solrconfig.xml,修改datadir:
<!-- Data Directory
Used to specify an alternate directory to hold all index data
other than the default ./data under the Solr home. If
replication is in use, this should match the replication
configuration.
-->
<dataDir>${solr.data.dir:D:\apache-tomcat-7.0.40\solr\data}</dataDir>
6. 防止乱码的在tomcat/conf/server.xml中加入;
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
URIEncoding="UTF-8"/>
7. 将D:\solr-4.4.0\\example\lib\ext下的5个jar包和D:\solr-4.4.0\\example\resources下的log4j放入tomcat的lib目录下
8. 重新启动tomcat,浏览器中输入:http://localhost:8080/solr