ES改變主分片數量,動態拆分primary shard

 

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

如何拆分工作

拆分操作:

  1. 創建一個新的目標索引,其定義與源索引相同,但具有更多的主分片
  2. 將段從源索引硬鏈接到目標索引。(如果文件系統不支持硬鏈接,則將所有段都複製到新索引中,這是一個非常耗時的過程。)
  3. 創建低級文件後,再次對所有文檔進行哈希處理,以刪除屬於不同分片的文檔。
  4. 恢復目標索引,就好像它是剛剛重新打開的封閉索引一樣。

詳見官方文檔es7.6

轉載請表明鏈接:https://blog.csdn.net/wabiaozia/article/details/105746993

4 參考

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章