最近在ubuntu下折腾tomcat7+solr4.2
由于之前有一些经验,知道我可以把索引的路径在solr/home的solr.xml文件中设置,例如:
<cores adminPath="/admin/cores" defaultCoreName="collection1" host="${host:}" hostPort="${jetty.port:}">
<core name="example1" instanceDir="path of example1" />
<core name="example2" instanceDir="....." />
<core name="example3" instanceDir="....." />
</cores>
</solr>
但是如何设置我的solr/home呢?也就是问,怎么样指定我的solr.xml的路径。因为默认该文件会放在tomcat的bin下,所以如果想要灵活一些,需要找到这个的指定位置。
由于我是使用war包来搭建solr的,所以在tomcat/webapps/solr/WEB-INF/web.xml中设置。
<!-- People who want to hardcode their "Solr Home" directly into the
WAR File can set the JNDI property here...
-->
<env-entry>
<env-entry-name>solr/home</env-entry-name>
<env-entry-value>/home/kehl/solr_home</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
大功告成