windows下部署solr

把solr运行起来,还不容易,折腾了不少时间。
之前,需要把tomcat/conf/server.xml中的Connector添加UTF-8处理能力:
xml代码 复制代码
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
URIEncoding="UTF-8" />


1.把刚下载的solr下dist下的apache-solr-xxx.war拷贝到tomcat的webapp下。

2.在tomcat的conf下,创建Catalina/localhost文件夹。

3.在localhost文件夹下,新建solr.xml文件,内容如下:
xml代码 复制代码
<?xml version="1.0" encoding="UTF-8" ?>
<Context docBase="c:/Program Files/tomcat-6.0.35/webapps/solr.war" debug="0" crossContext="true" >
<Environment name="solr/home" type="java.lang.String" value="c:/solr" override="true"/>
</Context>


说明:docBase就是刚拷贝过去的solr war绝对路径;Environment name="solr/home"是一个变量名,不用改变,其value就是我们想存放solr配置文件、索引的地方。

4.把solr下example\solr下的所有内容,拷贝到c:/solr下。

5.到这里,如果直接运行tomcat会有报错:
严重: org.apache.solr.common.SolrException: Error Instantiating QueryResponseWriter, solr.VelocityResponseWriter is not a org.apache.solr.response.QueryResponseWriter

查看solrconfig.xml,发现有这样的设置:
xml代码
 <!-- The solr.velocity.enabled flag is used by Solr's test cases so that this response writer is not
         loaded (causing an error if contrib/velocity has not been built fully) -->
    <queryResponseWriter name="velocity" class="solr.VelocityResponseWriter" enable="${solr.velocity.enabled:true}"/>

ok,找到问题,直接设置成false就行。

至此,solr正常运行起来了。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值