简体   繁体   English

跨多个Solr 4.6内核的共享架构和配置

[英]Shared schema and configuration across multiple Solr 4.6 cores

I have a number of sites which I am indexing using Solr 4.6.0 and I wish to maintain separate cores for each. 我有许多站点正在使用Solr 4.6.0编制索引,我希望为每个站点维护独立的核心。 Each of the cores will share the same schema.xml and same solrconfig.xml. 每个内核将共享相同的schema.xml和相同的solrconfig.xml。 Ideally, I would be able to create new cores through the admin console and Solr would pick up my default core configuration. 理想情况下,我将能够通过管理控制台创建新核心,Solr将选择我的默认核心配置。

Currently, when I create a new core I am creating a new directory in the filesystem named as I would want the core to be. 当前,当我创建一个新的核心时,我正在文件系统中创建一个新目录,命名为我想要的核心。 I am then adding to that: 然后,我要补充一点:

  1. A core.properties file (which just contains a single name=myycorename property. 一个core.properties文件(仅包含一个name = myycorename属性。
  2. A conf folder with a copy of the generic schema.xml and solrconfig.xml files conf文件夹,其中包含通用schema.xml和solrconfig.xml文件的副本

I have tried putting the following in the core.properties file a level up and referencing relatively: 我尝试将以下内容放入core.properties文件中,并进行相对引用:

schema=../configs/template/schema.xml
config=../configs/solrconfig.xml

I have also tried symlinking (not ideal as I would like this to run on windows/osx/linux. 我也尝试了符号链接(不理想,因为我希望它在Windows / OSX / Linux上运行。

But Solr does not seem to like relative references outside of the directory. 但是Solr似乎不喜欢目录之外的相对引用。 The configName property mentioned in Core Discovery 4.4 and Beyond Core Discovery 4.4及更高版本中提到的configName属性

Is it possible to have this kind of default configuration within Solr? Solr中是否可以具有这种默认配置?

As of Solr 4.8 , cores can use config sets to share common configurations (ie, "solrconfig.xml", "schema.xml", etc.) between multiple cores. 从Solr 4.8开始 ,内核可以使用配置集在多个内核之间共享通用配置(即“ solrconfig.xml”,“ schema.xml”等)。

You want to change your directory structure to: 您要将目录结构更改为:

./
├─ solr.xml
├─ configsets/
|  └─ template/
|     └─ conf/
|        ├─ schema.xml
|        ├─ solrconfig.xml
|        └─ ...
├─ core1/
|  ├─ core.properties
|  └─ data/
└─ core2/
   ├─ core.properties
   └─ data/

This defines one config set named template . 这定义了一个名为template的配置集。 Everything that would go under the core's "conf/" directory should be under the config set's "conf/" directory. 内核的“ conf /”目录下的所有内容都应在配置集的“ conf /”目录下。

Then, in each of your "core.properties" files, set configSet and omit schema and config : 然后,在每个“ core.properties”文件中,设置configSet并省略schemaconfig

# core.properties
name=...
configSet=template

Now your cores using the template config set will share "schema.xml", "solrconfig.xml", etc. 现在,使用模板配置集的核心将共享“ schema.xml”,“ solrconfig.xml”等。

Unfortunately, the admin interface doesn't directly support assigning the configSet property. 不幸的是,管理界面不直接支持分配configSet属性。 But if you use the CoreAdmin API, you can set configSet with the CREATE command. 但是,如果您使用CoreAdmin API,则可以使用CREATE命令设置configSet Eg, 例如,

http://localhost:8983/solr/admin/cores?action=CREATE&name=coreX&configSet=template

When you create a new core, it shares the config files of the existing Solr instance by default. 创建新核心时,默认情况下,它共享现有Solr实例的配置文件。 But you can mention different config files for the newly created cores. 但是您可以为新创建的内核提到不同的配置文件。 Please refer http://wiki.apache.org/solr/CoreAdmin 请参考http://wiki.apache.org/solr/CoreAdmin

config=different_solrconfig.xml&schema=different_schema.xml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM