转载请出自出处:http://www.cnblogs.com/hd3013779515/

1.创建collection

name:指明collection名字

router.name:指定路由策略,默认为compositeId路由

numShards:collection的逻辑分片数量

shards:指定具体的shard列表

replicationFactor:一个分片的replicas数量

maxShardsPerNode :一个solr节点上可以创建的逻辑分片数量,默认值为1

createNodeSet:可以指定在那些solr节点上创建collection

路由规则

SolrCloud中对于文档分布在哪个shard上,提供了两种路由算法:compositeId和implicit

在创建Collection时,需要通过router.name指定路由策略,默认为compositeId路由。

compositeId

该路由为一致性哈希路由,shards的哈希范围从80000000~7fffffff。初始创建collection是必须指定numShards个数,compositeId路由算法根据numShards的个数,计算出每个shard的哈希范围,因此路由策略不可以扩展shard。

implicit

该路由方式指定索引具体落在路由到哪个Shard,这与compositeId路由方式索引可均匀分布在每个shard上不同。同时只有在implicit路由策略下才可创建shard。

利用solrJ新建索引时,需要在代码中指定索引具体落在哪个shard上,添加代码:

doc.addField("_route_", "shard_X");

同时在schema.xml添加字段

<field name="_route_" type="string"/>

当我们想指定配置文件,索引目录时,可以加入如下参数

property.name=value

string

No

 

Set core property name to value. See core.properties file contents.

可选参数如下:

key

Description

name

The name of the SolrCore. You'll use this name to reference the SolrCore when running commands with the CoreAdminHandler.

config

The configuration file name for a given core. The default is solrconfig.xml.

schema

The schema file name for a given core. The default is schema.xml

dataDir

Core's data directory as a path relative to the instanceDir, data by default.

configSet

If set, the name of the configset to use to configure the core (see Config Sets).

properties

The name of the properties file for this core. The value can be an absolute pathname or a path relative to the value of instanceDir.

transient

If true, the core can be unloaded if Solr reaches the transientCacheSize. The default if not specified is false. Cores are unloaded in order of least recently used first.

loadOnStartup

If true, the default if it is not specified, the core will loaded when Solr starts.

coreNodeName

Added in Solr 4.2, this attributes allows naming a core. The name can then be used later if you need to replace a machine with a new one. By assigning the new machine the same coreNodeName as the old core, it will take over for the old SolrCore.

ulogDir

The absolute or relative directory for the update log for this core (SolrCloud)

shard

The shard to assign this core to (SolrCloud)

collection

The name of the collection this core is part of (SolrCloud)

roles

Future param for SolrCloud or a way for users to mark nodes for their own use.

使用Collections API:CREATE来创建collection时需要符合下面的条件。

shards*replicationFactor <= maxShardsPerNode*Node数

http://192.168.137.171:8080/solr-cloud/admin/collections?action=CREATE&name=myc&numShards=2&replicationFactor=3&maxShardsPerNode=2

http://192.168.137.171:8080/solr-cloud/admin/collections?action=CREATE&name=myc2&numShards=2&replicationFactor=2&maxShardsPerNode=2&createNodeSet=192.168.137.171:8080_solr-cloud,192.168.137.172:8080_solr-cloud

http://192.168.137.171:8080/solr-cloud/admin/collections?action=CREATE&name=myc3&router.name=implicit&shards=shard1,shard2&replicationFactor=3&maxShardsPerNode=3

指定配置文件

http://192.168.137.171:8080/solr-cloud/admin/collections?action=CREATE&name=myc2&numShards=2&replicationFactor=3&maxShardsPerNode=2&collection.configName=myconf2&property.config=solrconfig2.xml&property.schema=schema2.xml

2.删除collection

http://192.168.137.171:8080/solr-cloud/admin/collections?action=DELETE&name=myc2

3.RELOAD collection

如果schema中的属性有变动,只需要将正确的schema上传到服务器上之后重启solr即可

http://192.168.137.171:8080/solr-cloud/admin/collections?action=RELOAD&name=myc

4. SPLITSHARD(纵向扩容)

使用Collections API:SPLITSHARD来创建SHARD时不需要符合下面的条件。

shards*replicationFactor <= maxShardsPerNode*Node数

整体逻辑:无缝连接和无downtime

旧shard此时继续提供服务并把旧索引转到新的shard上

旧shard同时继续索引新文档

旧shard同时把新文档转发给新shard,新shard索引新文档

旧索引全部迁移到新shard之后,旧shard关闭,新文档直接转发到新的shard上了

手动利用DELETESHARD API删除旧shard

implicit路由:只要创建Shard即可: 新建索引时,将索引建到新建Shard上,查询操作时,指定collection名称,得到的仍是整个集群返回的结果。

compositeId路由:通过分裂(SPLITSHARD)操作实现。

http://192.168.137.171:8080/solr-cloud/admin/collections?action=SPLITSHARD&collection=myc&shard=shard1

5.CREATESHARD

路由规则为implicit 时才可以使用。

使用Collections API:CREATESHARD来创建shard时需要符合下面的条件。

shards*replicationFactor <= maxShardsPerNode*Node数

http://192.168.137.171:8080/solr-cloud/admin/collections?action=CREATESHARD&collection=myc3&shard=shard3

6. DELETESHARD

删除inactive shard

http://192.168.137.171:8080/solr-cloud/admin/collections?action=DELETESHARD&collection=myc2&shard=shard1

7.CREATEALIAS

实现跨collection查询,新建和修改都是使用CREATEALIAS。

http://192.168.137.171:8080/solr-cloud/admin/collections?action=CREATEALIAS&name=newc&collections=myc,myc2

8.DELETEALIAS

http://192.168.137.171:8080/solr-cloud/admin/collections?action=DELETEALIAS&name=newc

9.DELETEREPLICA

http://192.168.137.171:8080/solr-cloud/admin/collections?action=DELETEREPLICA&collection=myc2&shard=shard2&replica=192.168.137.171:8080_solr-cloud_myc2_shard2_replica2
 
10.ADDREPLICA
http://192.168.137.171:8080/solr-cloud/admin/collections?action=ADDREPLICA&collection=myc2&shard=shard2&node=192.168.137.171:8080_solr-cloud

使用Collections API:ADDREPLICA来创建replica时不需要符合下面的条件。

shards*replicationFactor <= maxShardsPerNode*Node数

13.1SolrCloud集群使用手册之Collections API的更多相关文章

  1. 13.2SolrCloud集群使用手册之CoreAdmin API

    转载请出自出处:http://www.cnblogs.com/hd3013779515/ CoreAdminHandler是用来管理Solr cores的,用来管理一个Solr instance中所有 ...

  2. 13.4SolrCloud集群使用手册之CRUD

    转载请出自出处:http://www.cnblogs.com/hd3013779515/ Student.java package cn.ljh.ssm.test; import org.apache ...

  3. 13.3SolrCloud集群使用手册之Zookeeper指令

    转载请出自出处:http://www.cnblogs.com/hd3013779515/ 1.upconfig java -classpath .:/home/solr/cloud/lib/* org ...

  4. Ubuntu_10.04下Hadoop-0.20.2集群配置手册

    Ubuntu_10.04下Hadoop-0.20.2集群配置手册 一.软硬件环境的准备 下面的文章来自hadoopor.com,我先交待一下我自己的环境: 两台机器,每台机器上面两个虚机(vmware ...

  5. Nginx+Tomcat+MemCached 集群配置手册

    系统实施文档 Nginx+Tomcat+MemCached 集群配置手册 目    录 第1章   概述 1.1   目标 互联网的快速发展带来了互联网系统的高负载和高可用性, 这要求我们在设计系统架 ...

  6. 实现CI/CDk8s高可用集群搭建总结以及部署API到k8s

    实现CI/CD(Centos7.2)系列二:k8s高可用集群搭建总结以及部署API到k8s 前言:本系列博客又更新了,是博主研究很长时间,亲自动手实践过后的心得,k8s集群是购买了5台阿里云服务器部署 ...

  7. OEMCC 13.2 集群版本安装部署

    之前测试部署过OEMCC 13.2单机,具体可参考之前随笔: OEMCC 13.2 安装部署 当时环境:两台主机,系统RHEL 6.5,分别部署OMS和OMR: OMS,也就是OEMCC的服务端 IP ...

  8. Greenplum(4.3.73)集群安装手册

    1. 概述 本文档仅限于指导Greenplum 4.3.7.3(对应安装包greenplum-db-4.3.7.3-build-2-RHEL5-x86_64.bin)版本在CentOS6.5 系统进行 ...

  9. kubeadm安装kubernetes 1.13.1集群完整部署记录

    k8s是什么 Kubernetes简称为k8s,它是 Google 开源的容器集群管理系统.在 Docker 技术的基础上,为容器化的应用提供部署运行.资源调度.服务发现和动态伸缩等一系列完整功能,提 ...

随机推荐

  1. 了解java虚拟机—并行回收器(7)

    并行回收器 新生代ParNew回收器 ParNew只是简单地将串行回收器多线程化,他的回收策略,算法以及参数都喝新生代串行回收器一样.由于并行回收器使用多线程进行垃圾回收,因此,在并发能力强的CPU上 ...

  2. Lucene 学习-安装 Kibana 视图界面

    Kibana 是一个开源的分析与可视化平台,设计出来用于和 Elasticsearch 一起使用的. 你可以使用 Kibana 搜索.查看.交互存放在 Elasticsearch 索引里的数据.使用各 ...

  3. python序列函数

    zip:序列并行处理 >>> name=['ghostwu','wukong','bajie'] >>> age=['] >>> sex=['ma ...

  4. win7游戏窗口设置

    在开始搜索框输入regedit打开注册表,定位到HKEY_LOCAL_MACHINE------SYSTEM------ControlSet001-------Control-------Graphi ...

  5. python学习之老男孩python全栈第九期_day015作业_老男孩Python全9期练习题(面试真题模拟)

    一. 选择题(32分) 1. python不支持的数据类型有:AA. charB. intC. floatD. list 2. Ex = ‘foo’y = 2print(x + y)A. fooB. ...

  6. js-ES6学习笔记-Class

    1.ES6提供了更接近传统语言的写法,引入了Class(类)这个概念,作为对象的模板.通过class关键字,可以定义类. 2. //定义类 class Point { constructor(x, y ...

  7. 【读书笔记】iOS-网络-同步请求,队列式异步请求,异步请求的区别

    一,同步请求的最佳实践. 1,只在后台过程中使用同步请求,除非确定访问的是本地文件资源,否则请不要在主线程上使用. 2,只有在知道返回的数据不会超出应用的内存时才使用同步请求.记住,整个响应体都会位于 ...

  8. 学习ES6的全部特性

    ES6 简介 ECMAScript 6 简称 ES6,是 JavaScript 语言的下一代标准,已经在2015年6月正式发布了.它的目标是使得 JavaScript 语言可以用来编写复杂的大型应用程 ...

  9. JS--我发现,原来你是这样的JS(三)(基础概念--灵魂篇)

    一.介绍 这是红宝书(JavaScript高级程序设计 3版)的读书笔记第三篇(灵魂篇介绍),有着剩下的第三章的知识内容. 红宝书这本书可以说是难啃的,要看完不容易,挺厚的,要看懂更不容易,要熟练js ...

  10. Jquery UI Custom的兼容问题

    在测试过程中遇到Jquery UI Dialog异常的情况,表现为在拖拽Dialog标头时出现Dialog跳跃的问题,对比jquery ui与jquery在协调工作情况下的运行情况. 1.环境: Wi ...