阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Tomcat7.0.27下安装Solr4.6.0

113次阅读
没有评论

共计 2667 个字符,预计需要花费 7 分钟才能阅读完成。

应项目经理要求,我们项目需要做搜索的功能。搜索这块的任务交给了我,技术方案是 Solr。于是花了一下午时间在比较新的 tomcat 下装起了一个目前最新的 solr。

安装步骤:

首先弄到 tomcat 和 solr4.6 的包,这自不必说!然后将 solr 解压在:F:\solr\solr-4.6.0 这下面,将 tomcat 解压在:F:\solr\tomcat7.0.27。同时新建一个 solr 运行用的文件夹:F:\solr\SolrHome。并将下载的 solr 包中的 example/solr 文件夹下面的所有文件放入到 F:\solr\SolrHome。同时将 solr 包里面的:F:\solr\solr-4.6.0\dist\solr-4.6.0.war 复制到 tomcat 里面的 webapps 文件夹下面,同时改名为 solr.war。

在 tomcat 的 conf/Catalina/localhost 下添加 solr.xml 文件,文件内容如下:

<?xml version=”1.0″ encoding=”UTF-8″ standalone=”yes”?>
<Context docBase=”F:\solr\tomcat7.0.27\webapps\solr.war” debug=”0″ crossContext=”true” >
  <Environment name=”solr/home” type=”Java.lang.String” value=”F:\solr\SolrHome” override=”true” />
</Context>

docbase 是 solr 的 war 包的绝对地址,value 是 solr 的运行环境。

双击 tomcat 的 startup.bat,这是 tomcat 会报错!

[SetContextPropertiesRule]{Context} Setting property ‘debug’ to ‘0’ did not find a matching property.
2013-12-26 20:02:57 org.apache.catalina.core.StandardContext startInternal
严重: Error filterStart
2013-12-26 20:02:57 org.apache.catalina.core.StandardContext startInternal
严重: Context [/solr] startup failed due to previous errors

但是这个日志让人很蛋疼,就报了个错,啥都没有,最狠这种日志了!!

在 tomcat 的 logs 文件夹下面查了下 localhost.2013-12-26.log 这个日志文件,才找到了问题的症结!

2013-12-26 20:02:57 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter SolrRequestFilter
org.apache.solr.common.SolrException: Could not find necessary SLF4j logging jars. If using Jetty, the SLF4j logging jars need to go in the jetty lib/ext directory. For other containers, the corresponding directory should be used. For more information, see: http://wiki.apache.org/solr/SolrLogging
at org.apache.solr.servlet.SolrDispatchFilter.<init>(SolrDispatchFilter.java:111)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

这不就是缺 jar 包嘛!!缺 slf4j.jar。果断把 F:\solr\solr-4.6.0\example\lib\ext 这个路径下的所有 slf4j 相关的 jar 包拷进了 F:\solr\tomcat7.0.27\webapps\solr\WEB-INF\lib 这个文件夹,也就是应用的 lib 文件夹下。同时把 solr 包下的 F:\solr\solr-4.6.0\example\resources\log4j.properties 这个日志文件拷近 F:\solr\tomcat7.0.27\webapps\solr\WEB-INF\classes。

Tomcat7.0.27 下安装 Solr4.6.0

重启 tomcat!我的 solr 跑起来了!哈哈! 回家。

Solr 的详细介绍 :请点这里
Solr 的下载地址 :请点这里

相关阅读:

Solr3.6.1 在 Tomcat6 下的环境搭建 http://www.linuxidc.com/Linux/2013-01/77664.htm

基于 Tomcat 的 Solr3.5 集群部署 http://www.linuxidc.com/Linux/2012-12/75297.htm

在 Linux 上使用 Nginx 为 Solr 集群做负载均衡 http://www.linuxidc.com/Linux/2012-12/75257.htm

Linux 下安装使用 Solr http://www.linuxidc.com/Linux/2012-10/72029.htm

在 Ubuntu 12.04 LTS 上通过 Tomcat 部署 Solr 4 http://www.linuxidc.com/Linux/2012-09/71158.htm

Solr 实现 Low Level 查询解析(QParser)http://www.linuxidc.com/Linux/2012-05/59755.htm

基于 Solr 3.5 搭建搜索服务器 http://www.linuxidc.com/Linux/2012-05/59743.htm

Solr 3.5 开发应用教程 PDF 高清版 http://www.linuxidc.com/Linux/2013-10/91048.htm

Solr 4.0 部署实例教程 http://www.linuxidc.com/Linux/2013-10/91041.htm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-20发表,共计2667字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中