参考出处:https://github.com/x113773/testall/issues/6
部署:
1、首先把solr-6.6.1\server\solr-webapp中的webapp目录拷贝到apache-tomcat-7.0.56下的webapps目录里,重命名为solr;
2、将solr-6.6.1\server\lib\ext下的所有jar包,以及solr-6.6.1\server\lib下以metrics开头的jar包复制到apache-tomcat-7.0.56\webapps\solr\WEB-INF\lib下;
3、在apache-tomcat-7.0.56\webapps\webapp\WEB-INF中,新建classes文件夹,将solr-6.6.1\server\resources下的log4j.properties文件拷贝到里面,修改里面的solr.log=输出日志的路径(请使用/分割,注意不要有中文,避免乱码问题);
4、创建一个core(https://github.com/x113773/testall/issues/7),然后将solr-6.6.1\server中的solr目录拷贝到E盘,重命名为solrhome;
5、修改apache-tomcat-7.0.56\webapps\solr\WEB-INF中的web.xml文件:
6、打开如下注释,修改为solrhome路径
<env-entry>
<env-entry-name>solr/home</env-entry-name>
<env-entry-value>E:/solrhome</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
并注释掉如下代码
<!-- <security-constraint>
<web-resource-collection>
<web-resource-name>Disable TRACE</web-resource-name>
<url-pattern>/</url-pattern>
<http-method>TRACE</http-method>
</web-resource-collection>
<auth-constraint/>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Enable everything but TRACE</web-resource-name>
<url-pattern>/</url-pattern>
<http-method-omission>TRACE</http-method-omission>
</web-resource-collection>
</security-constraint>-->
7、启动tomcat,访问http://localhost:8080/solr/index.html
根据以上步骤配置好后在第7步访问页面页面提示 :SolrCore Initialization Failures。solr 站点一直无法正常浏览!
后面仔细分析了solr.log 日志,发现如下警告信息:
2017-09-14 09:45:36.060 WARN (coreLoadExecutor-6-thread-1) [ x:mycore1] o.a.s.c.SolrConfig Couldn't add files from E:\solrhome\mycore1\..\..\..\..\contrib\extraction\lib filtered by .*\.jar to classpath: E:\solrhome\mycore1\..\..\..\..\contrib\extraction\lib
2017-09-14 09:45:36.063 WARN (coreLoadExecutor-6-thread-1) [ x:mycore1] o.a.s.c.SolrConfig Couldn't add files from E:\solrhome\mycore1\..\..\..\..\dist filtered by solr-cell-\d.*\.jar to classpath: E:\solrhome\mycore1\..\..\..\..\dist
2017-09-14 09:45:36.064 WARN (coreLoadExecutor-6-thread-1) [ x:mycore1] o.a.s.c.SolrConfig Couldn't add files from E:\solrhome\mycore1\..\..\..\..\contrib\clustering\lib filtered by .*\.jar to classpath: E:\solrhome\mycore1\..\..\..\..\contrib\clustering\lib
2017-09-14 09:45:36.064 WARN (coreLoadExecutor-6-thread-1) [ x:mycore1] o.a.s.c.SolrConfig Couldn't add files from E:\solrhome\mycore1\..\..\..\..\dist filtered by solr-clustering-\d.*\.jar to classpath: E:\solrhome\mycore1\..\..\..\..\dist
2017-09-14 09:45:36.065 WARN (coreLoadExecutor-6-thread-1) [ x:mycore1] o.a.s.c.SolrConfig Couldn't add files from E:\solrhome\mycore1\..\..\..\..\contrib\langid\lib filtered by .*\.jar to classpath: E:\solrhome\mycore1\..\..\..\..\contrib\langid\lib
2017-09-14 09:45:36.065 WARN (coreLoadExecutor-6-thread-1) [ x:mycore1] o.a.s.c.SolrConfig Couldn't add files from E:\solrhome\mycore1\..\..\..\..\dist filtered by solr-langid-\d.*\.jar to classpath: E:\solrhome\mycore1\..\..\..\..\dist
2017-09-14 09:45:36.065 WARN (coreLoadExecutor-6-thread-1) [ x:mycore1] o.a.s.c.SolrConfig Couldn't add files from E:\solrhome\mycore1\..\..\..\..\contrib\velocity\lib filtered by .*\.jar to classpath: E:\solrhome\mycore1\..\..\..\..\contrib\velocity\lib
2017-09-14 09:45:36.066 WARN (coreLoadExecutor-6-thread-1) [ x:mycore1] o.a.s.c.SolrConfig Couldn't add files from E:\solrhome\mycore1\..\..\..\..\dist filtered by solr-velocity-\d.*\.jar to classpath: E:\solrhome\mycore1\..\..\..\..\dist
分析是在第4步生成core 的时候最终生成的没有mycore1 中的配置文件对solr 路径应用不对。我自己的配置地址E:\solrhome\mycore1\conf\solrconfig.xml
修改正:
1、将mycore1 中的 solrconfig.xml 关于solr dir 地址,替换为solr 6.6.1 放置路径的相对路径,或者直接写成绝对路径。
2、因为是用的xampp 集成开发环境 自带Tomcat7.0.56 。后面发现主要是和solr6.6.1 版本不匹配。 直接升级apache-tomcat-8.5.20 。 话说是因为tomcat7上的javax-servlet和Solr6的jar包冲突。
升级后访问http://localhost:8080/solr/index.html 一切正常。 比较坑!