利用SOLR搭建企业搜索平台 之——MultiCore
2014-12-30 17:24
369 查看
Solr Multicore 是 solr 1.3 的新特性。其目是一个solr实例,可以有多个搜索应用。
下面着手来将solr给出的一个example跑出来。这篇文章是基于《利用SOLR搭建企业搜索平台 之——运行solr》,有不明白的请参见http://lianj-lee.javaeye.com/blog/424383
1、 找到solr下载包中的example文件夹,在它的下面有个multicore文件夹,将这个文件夹下面的所有东西copy到 c:/solr-tomcat/solr下面。
注意:有一个 solr.xml(这只是默认文件,当然也可以指定别的文件),如:
这个文件是告诉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。
给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
下面着手来将solr给出的一个example跑出来。这篇文章是基于《利用SOLR搭建企业搜索平台 之——运行solr》,有不明白的请参见http://lianj-lee.javaeye.com/blog/424383
1、 找到solr下载包中的example文件夹,在它的下面有个multicore文件夹,将这个文件夹下面的所有东西copy到 c:/solr-tomcat/solr下面。
注意:有一个 solr.xml(这只是默认文件,当然也可以指定别的文件),如:
<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
3、采用上面的默认solr.xml,索引文件将存放在同一个目录下面,在这里将存放在C:/solr- tomcat/solr/data,如果你想更改目录,或者两个应用存放在不同的目录,请参见下面的xml。
<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
相关文章推荐
- 利用SOLR搭建企业搜索平台 之四(MultiCore)
- 利用SOLR搭建企业搜索平台 之四(MultiCore)
- 利用SOLR搭建企业搜索平台 之四(MultiCore)
- 利用Solr搭建企业搜索平台之一-Solr运行
- 利用SOLR搭建企业搜索平台之十二 (字段增加权重)
- 利用Solr搭建企业搜索平台之一-Solr运行
- 利用SOLR搭建企业搜索平台 之五(solrj)
- 利用SOLR搭建企业搜索平台 之六 (分布式题外话)linux ssh 免密码登陆
- 利用SOLR搭建企业搜索平台 之五(solrj)
- 利用SOLR搭建企业搜索平台 之——模式配置Schema.xml
- 利用SOLR搭建企业搜索平台 之三(配置文件)
- 利用SOLR搭建企业搜索平台 之一(运行solr)
- 利用SOLR搭建企业搜索平台 之三(配置文件)
- 利用SOLR搭建企业搜索平台 之六(solr查询参数说明)
- 利用SOLR搭建企业搜索平台 之七(solr使用问题集)
- 利用SOLR搭建企业搜索平台 之九(solr的查询语法)
- 利用SOLR搭建企业搜索平台 之十(数据库数据导入到solr)
- 利用SOLR搭建企业搜索平台 之十一(中文分词之IK)
- 利用SOLR搭建企业搜索平台 之——solr的查询语法
- 利用SOLR搭建企业搜索平台 之三(配置文件)