solr multicore

2019-03-27 01:02|来源: 网路

开发配置solr的multicore,

在solr的安装包,example下有个multicore,把该文件下的所有文件,包括solr.xml,都拷贝到已经配置好的solr.home目录下。参考(原文地址:http://lianj-lee.javaeye.com/blog/425414):

1》找到solr下载包中的example文件夹,在它的下面有个multicore文件夹,将这个文件夹下面的所有东西copy到 c:"solr-tomcat"solr下面。
注意:有一个 solr.xml(这只是默认文件,当然也可以指定别的文件),如:

Xml代码 复制代码
  1. <?xml version="1.0" encoding="UTF-8" ?>     
  2.     <solr persistent="false">       
  3.       <cores adminPath="/admin/cores">     
  4.         <core name="core0" instanceDir="core0" />     
  5.         <core name="core1" instanceDir="core1" />     
  6.       </cores>     
  7.     </solr>    
<?xml version="1.0" encoding="UTF-8" ?>   	<solr persistent="false">     	  <cores adminPath="/admin/cores">   	    <core name="core0" instanceDir="core0" />   	    <core name="core1" instanceDir="core1" />   	  </cores>   	</solr>  


这个文件是告诉solr应该加载哪些core,cores里有 core0,core1。core0(可以类比以前的solr.home)/conf目录下有schema.xml与solrconfig.xml,可以把实际应用的复制过来。现示例就用官方的了。

2》启动tomcat,访问应用,就可以看到有 Admin core0 和 Admin core1 http://localhost:8080/solr/

3》采用上面的默认solr.xml,索引文件将存放在同一个目录下面,在这里将存放在C:"solr-tomcat"solr"data,如果你想更改目录,或者两个应用存放在不同的目录,请参见下面的xml。

Xml代码 复制代码
  1. <core name="core0" instanceDir="core0">  
  2.     <property name="dataDir" value="/data/core0" />  
  3.  </core>  
<core name="core0" instanceDir="core0">     <property name="dataDir" value="/data/core0" />  </core>

给core添加子元素 property,property的两个属性就不说了,一看就能明白!
solr.core.name -- The core's name as defined in solr.xml
solr.core.instanceDir -- The core's instance directory (i.e. the directory under which that core's conf/ and data/ directory are located)
solr.core.dataDir -- The core's data directory (i.e. the directory under which that core's index directory are located)
solr.core.configName -- The name of the core's config file (solrconfig.xml by default)
solr.core.schemaName -- The name of the core's schema file (schema.xml by default)

4》 solr.xml具体含义:
1) solr
The < solr> tag accepts two attributes:
persistent - By default, should runtime core manipulation be saved in solr.xml so that it is available after a restart.
sharedLib - Path to a directory containing .jar files that are added to the classpath of every core. The path is relative to solr.home (where solr.xml sits)
2)cores
The <cores> tag accepts two attribute:
adminPath - Relative path to access the CoreAdminHandler for dynamic core manipulation. For example, adminPath="/admin/cores" configures access via  http://localhost:8983/ solr/admin/cores. If this attribute is not specified, dynamic manipulation is unavailable.
3)core
The <core> tag accepts two attributes:
name - The registered core name. This will be how the core is accessed.
instanceDir - The solr.home directory for a given core.
dataDir - The data directory for a given core. The default is <instanceDir>/data . It can take an absolute path or a relative path w.r.t instanceDir .  Solr1.4
4)property
The <property> tag accepts two attributes:
name - The name of the property
value - The value of the property
转自:http://www.cnblogs.com/wycg1984/archive/2009/09/16/1567549

相关问答

更多
  • 在SolrCloud中,您的每个Core都将成为Collection 。 每个Collection都有自己的一组配置文件和数据。 您可能会发现这个有用的移动多核SOLR实例到云 Solr 5.0(以后)对如何使用分片创建SolrCloud设置以及如何添加集合等进行了一些更改。 下面列出的所有内容都是我对Solr参考指南的理解。 我强烈建议彻底完成它。 https://cwiki.apache.org/confluence/display/solr/Apache+Solr+Reference+Guide 我在 ...
  • 工作解决方案: 使用此或此说明安装Java8。 下载solr 。 我使用的是6.2.0版。 从solr-xyztg解压缩bin目录中的install_solr_service.sh脚本( bin/install_solr_service.sh )。 使用上面tgz文件的名称作为第一个参数( ./install_solr_service.sh solr-xyztgz )运行此脚本。 它将为您的系统安装solr。 核心将位于/opt/solr目录中,数据将位于/var/solr 。 使用service solr ...
  • 你有没有对它进行整理或复制? 如果您不知道,请阅读此内容 。 1)通过solr在内部同步分片或复制,因此应在两个核心中对其进行分割或添加。 2)无论哪一个,solr为你做这件事,你只需要让zooKeeper准备接受并平衡每个核心之间的请求。 3)如果您要将数据添加到复制的核心,则不能,但如果您正在分析核心,我认为这是可能的,它在这里得到了回答: 如何使用solrj索引特定分片中的数据 Did you shard it or was it replicated? Read this if you don't ...
  • Solr不会阻止您在单个集合中托管多个实体。 您可以为这两个实体定义字段,并将它们托管在集合中。 如果要过滤每个实体的结果,则需要具有标识符来标识实体。 如果您的馆藏很小或者用户和汽车之间存在关系,那么在同一个馆藏中托管它们可能会有所帮助 对于Solr多核检查应答 Solr Multicore基本上是一个允许Solr托管多个内核的设置。 这些核心将托管一组完全不同的无关实体。 每个表也可以有一个单独的Core。 例如,如果您拥有完全不相关的实体的文档,人员,股票的集合,那么您希望在不同的集合中托管 多核设置 ...
  • Solr核心本质上是在应用程序服务器的相同上下文中运行的多个索引。 你可以认为它为每个用户安装了1个war文件 。 每个核心都以名称分隔,因此您必须自己跟踪哪个网址对哪个用户有效。 例如, http://host.com/solr/usercore1/select?q=test http://host.com/solr/usercore2/select?q=test 它基于config solr.xml :
  • 由于DATASOLR-203 , 目前无法直接完成此操作。 解决上述问题后,您可以按以下方式执行此操作: @Configuration @EnableSolrRepositories(multicoreSupport = true) static class SolrConfiguration { @Bean SolrServer solrServer() throws FileNotFoundException { String solrHome = ResourceUtils.get ...
  • SOLR中总有一个核心。 默认情况下,SOLR实例创建名为collection1的核心。 如果你有一个核心并且不确定如何在运行时重新加载,你可以使用它, http://localhost:8080/solr/admin/cores?action=RELOAD&core=collection1 As best as I can tell, online reloading requires a Multicore configuration, which it turns out isn't too har ...
  • 更多像这需要存储的唯一密钥。 MoreLikeThis requires a stored unique key.
  • 我想我解决了它...只需在solr.xml中指定相同的 instanceDir(但不同的dataDir) I think I solved it... simply by specifying the same instanceDir (but different dataDir) in the confiugation in solr.xml
  • 有一些设置允许您更动态地处理核心的卸载 。 首先,您需要将每个核心标记为transient="true" ,这意味着如果核心数量超过transientCacheSize ,则可以卸载核心。 后者是您可以在solr.xml 元素中添加的选项,而前者是针对每个核心定义(在core.properties中)。 通过API创建核心时,您还可以提供transient = true。 transientCacheSize的大小必须调整到你看到的负载,核心的大小和可用的内存量(并用于每个核心)。 听起来你已经 ...