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)有贊