1 Elasticsearch 2.x 版本
因为document路由机制,不可变变主分片(primary shard)
https://www.elastic.co/guide/cn/elasticsearch/guide/current/shard-scale.html
2 6.x之后
从ES6.1开始,ES 支持可以在线操作扩大shard的数量(注意:操作期间也需要对index锁写)
从ES7.0开始,split时候,不再需要加参数 index.number_of_routing_shards
具体参考官方文档:
https://www.elastic.co/guide/en/elasticsearch/reference/7.6/indices-split-index.html
https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-split-index.html
https://www.elastic.co/guide/en/elasticsearch/reference/6.1/indices-split-index.html
3 如何拆分工作
拆分操作:
- 创建一个新的目标索引,其定义与源索引相同,但具有更多的主分片。
- 将段从源索引硬链接到目标索引。(如果文件系统不支持硬链接,则将所有段都复制到新索引中,这是一个非常耗时的过程。)
- 创建低级文件后,再次对所有文档进行哈希处理,以删除属于不同分片的文档。
- 恢复目标索引,就好像它是刚刚重新打开的封闭索引一样。
详见官方文档es7.6。
转载请表明链接:https://blog.csdn.net/wabiaozia/article/details/105746993
4 参考
https://www.elastic.co/guide/en/elasticsearch/reference/7.6/indices-split-index.html
https://blog.51cto.com/lee90/2467377
https://tech.youzan.com/search-tech-2/ 索引拆分(不是拆分primary shard)有赞