Solr5创建Collection的多core。

来源:互联网 发布:知乎年度300问 编辑:程序博客网 时间:2024/05/21 07:09

  虽然一直在用Solr,但是一直没有对他进行比较深入的了解,最近正好有时间,研究了一下,主要是一直想对solr的collection进行分表,那样的话一天的数据一个表,比较规范,也比较好用。网上搜了一下,基本上都是通过多core来实现的。这里说一下创建的url:

http://127.0.0.1:8983/solr/admin/cores?action=CREATE
&name=collection2
&instanceDir=/opt/gshen/solr/collection2
&config=/opt/gshen/solr/conf/solrconfig.xml
&schema=/opt/gshen/solr/conf/schema.xml
&dataDir=/opt/gshen/solr/collection2/data

另外还有其他的参数,如:



Parameter

Type
Required
Default

Description

name

stringYesN/A

The name of the new core. Same as "name" on the <core> element.

instanceDir

stringNowhatever is specified for "name" parameter

The directory where files for this SolrCore should be stored. Same as instanceDir on the <core> element.

config

stringNo 

Name of the config file (i.e., solrconfig.xml) relative to instanceDir.

schema

stringNo 

Name of the schema file to use for the core. Please note that if you are using a "managed schema" (the default behavior) then any value for this property which does not match the effective managedSchemaResourceName will be read once, backed up, and converted for managed schema use.  See Schema Factory Definition in SolrConfig for details. 

dataDir

stringNo 

Name of the data directory relative to instanceDir.

configSetstringNo Name of the configset to use for this core. For more information, see the section Config Sets.

collection

stringNo 

The name of the collection to which this core belongs. The default is the name of the core. collection.<param>=<value> causes a property of <param>=<value> to be set if a new collection is being created. Use collection.configName=<configname>to point to the configuration for a new collection.

shard

stringNo 

The shard id this core represents. Normally you want to be auto-assigned a shard id.

property.name=valuestringNo Sets the core property name to value. See the section on defining core.properties file contents.asyncstringNo Request ID to track this action which will be processed asynchronously另外详细的参数可以参考:https://cwiki.apache.org/confluence/display/solr/CoreAdmin+API


Parameter

Type
Required
Default

Description

name

stringYesN/A

The name of the new core. Same as "name" on the <core> element.

instanceDir

stringNowhatever is specified for "name" parameter

The directory where files for this SolrCore should be stored. Same as instanceDir on the <core> element.

config

stringNo 

Name of the config file (i.e., solrconfig.xml) relative to instanceDir.

schema

stringNo 

Name of the schema file to use for the core. Please note that if you are using a "managed schema" (the default behavior) then any value for this property which does not match the effective managedSchemaResourceName will be read once, backed up, and converted for managed schema use.  See Schema Factory Definition in SolrConfig for details. 

dataDir

stringNo 

Name of the data directory relative to instanceDir.

configSetstringNo Name of the configset to use for this core. For more information, see the section Config Sets.

collection

stringNo 

The name of the collection to which this core belongs. The default is the name of the core. collection.<param>=<value> causes a property of <param>=<value> to be set if a new collection is being created. Use collection.configName=<configname>to point to the configuration for a new collection.

shard

stringNo 

The shard id this core represents. Normally you want to be auto-assigned a shard id.

property.name=valuestringNo Sets the core property name to value. See the section on defining core.properties file contents.asyncstringNo Request ID to track this action which will be processed asynchronously
跨core查询:


http://192.168.100.175:8080/solr/collection1/select?
q=message:中国人
&wt=json
&indent=true
&shards=192.168.100.175:8080/solr/collection1,192.168.100.175:8080/solr/collection2


 


 这里只列出了部分属性和功能,具体可到http://wiki.apache.org/solr/CoreAdmin查询使用方法。

Parameter

Type
Required
Default

Description

name

stringYesN/A

The name of the new core. Same as "name" on the <core> element.

instanceDir

stringNowhatever is specified for "name" parameter

The directory where files for this SolrCore should be stored. Same as instanceDir on the <core> element.

config

stringNo 

Name of the config file (i.e., solrconfig.xml) relative to instanceDir.

schema

stringNo 

Name of the schema file to use for the core. Please note that if you are using a "managed schema" (the default behavior) then any value for this property which does not match the effective managedSchemaResourceName will be read once, backed up, and converted for managed schema use.  See Schema Factory Definition in SolrConfig for details. 

dataDir

stringNo 

Name of the data directory relative to instanceDir.

configSetstringNo Name of the configset to use for this core. For more information, see the section Config Sets.

collection

stringNo 

The name of the collection to which this core belongs. The default is the name of the core. collection.<param>=<value> causes a property of <param>=<value> to be set if a new collection is being created. Use collection.configName=<configname>to point to the configuration for a new collection.

shard

stringNo 

The shard id this core represents. Normally you want to be auto-assigned a shard id.

property.name=valuestringNo Sets the core property name to value. See the section on defining core.properties file contents.asyncstringNo Request ID to track this action which will be processed asynchronously
0 0