zoukankan      html  css  js  c++  java
  • 利用SOLR搭建企业搜索平台 之四(MultiCore)

    Solr Multicore 是 solr 1.3 的新特性。其目的一个solr实例,可以有多个搜索应用。

    下面着手来将solr给出的一个example跑出来,在《利用SOLR搭建企业搜索平台 之一(运行solr)》这篇文章里面已经讲了怎样来运行solr,这篇文章是基于《利用SOLR搭建企业搜索平台 之一(运行solr)》,有不明白的请参见http://lianj-lee.javaeye.com/blog/424383

    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>    

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

    2》启动tomcat,访问应用,就可以看到有 Admin core0 和 Admin core1

    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添加子元素 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
    由于E文过于简单,所以就不翻译了!

    有关更具体的solr.xml的配置,请参见solr wiki http://wiki.apache.org/solr/CoreAdmin已经讲的非常清楚,我就不多说了!
  • 相关阅读:
    python_基础2
    springboot自定义配置文件类
    自定义实现spring-boot-starter-data-redis
    @ConditionalOnBean详解
    @Conditional详解
    并发包大神Doug Lea
    idea新建springboot项目
    springboot实现自定义start
    世界上唯一公平的事情就是每个人都会死。
    hashtable存null会发生什么?
  • 原文地址:https://www.cnblogs.com/wycg1984/p/1567590.html
Copyright © 2011-2022 走看看