问题描述
我整个上午都在尝试在Apache Tomcat服务器下运行的SOLR安装上设置多个内核,但没有成功.我的solr.xml看起来像这样:
I have spend all morning trying to set up multiple cores on a SOLR installation that runs under Apache Tomcat server without success. My solr.xml looks like this:
<solr persistent="false" sharedLib="lib">
<cores adminPath="/admin/cores">
<core name="core0" instanceDir="/multicore/core0">
<property name="dataDir" value="/multicore/core0/data" />
</core>
<core name="core1" instanceDir="/multicore/core1">
<property name="dataDir" value="/multicore/core1/data" />
</core>
</cores>
</solr>
正确的目录结构是什么?我需要在solrconfig.xml中做些更改吗?
What is the correct directory structure? Do I need to do change something in the solrconfig.xml?
推荐答案
检查您的instanceDir值是否相对于-Dsolr.solr.home.如果-Dsolr.solr.home为'multicore',则您的instanceDir应该仅为"core0".
Check that your instanceDir values are relative to -Dsolr.solr.home. If -Dsolr.solr.home is 'multicore', then your instanceDir should be only "core0".
如果将数据文件夹放在instanceDir中,则不必指定其路径:
If you put your data folder inside your instanceDir, you should not have to specify its path:
<?xml version='1.0' encoding='UTF-8'?>
<solr persistent="true">
<cores adminPath="/admin/cores">
<core name="core0" instanceDir="core0" />
<core name="core1" instanceDir="core1" />
</cores>
</solr>
您不必在solrconfig.xml中进行任何设置.但是,如果您需要独立于核心位置配置处理程序,则可以使用变量$ {solr.core.instanceDir}.
You should not have to set anything in solrconfig.xml. But if you need to configure an handler independantly of the core location, you can use the variable ${solr.core.instanceDir}.
更新
要为Tomcat设置solr.solr.home变量,请在启动Tomcat之前使用JAVA_OPTS环境变量:
To set the solr.solr.home variable with Tomcat, use the JAVA_OPTS environment variable before starting Tomcat:
JAVA_OPTS="-Dsolr.solr.home=multicore"
export JAVA_OPTS
tomcat/bin/catalina.sh start
确保相对于工作目录正确设置了多核".例如,如果solr.solr.home ='multicore',则必须从"multicore"所在的目录中启动Tomcat.
Make sure that "multicore" is correctly set relative to the working directory. Per example, if solr.solr.home='multicore', you have to launch Tomcat from the directory where "multicore" is located.
这篇关于Tomcat SOLR多核设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!