簡體   English   中英

ElasticSearch:如何禁用所有分片的分片重新分配?

[英]ElasticSearch: How to disable shard reallocation of all shards?

我為elasticsearch開發了一個搜索插件,但是當升級這個插件時,我需要逐個關閉節點,每次我都要等待重新分配過程很長時間。 在文檔中,它表示可以通過以下方式停止重新分配過程:

curl -XPUT localhost:9200/_cluster/settings -d '{
    "transient" : {
           "cluster.routing.allocation.enable" : "none"
     }
}'

當我運行此命令時,我得到以下錯誤:

ElasticsearchIllegalArgumentException[Can't update non dynamic settings[[index.transient.cluster.routing.allocation.enable]] for open indices[..]

我能做什么?

順便說一句:抱歉我的英語不好......

很近!

嘗試:

curl -XPUT 'http://localhost:9200/_cluster/settings' -d '{
"transient" : {
    "cluster.routing.allocation.disable_allocation": "true"
}}'

OP可能使用較舊的Elasticsearch版本,該版本不支持動態更新“cluster.routing.allocation.enable”和/或“cluster.routing.rebalance.enable”。

但是,在最近的Elasticsearch版本中,這兩個設置應該是dynamictransient ,不再是staticpersistent

以下是有關Elasticsearch當前doc的分片分配設置的更多詳細信息。

https://www.elastic.co/guide/en/elasticsearch/reference/current/shards-allocation.html

用戶可以在Kibana Dev Tool Console中應用/撤消這些設置,如下所示

PUT _cluster/settings
{
  "transient" : {
    "cluster.routing.allocation.enable": "none",
    "cluster.routing.rebalance.enable" : "none"
  }
}

# After bouncing ES cluster
PUT _cluster/settings
{
  "transient" : {
    "cluster.routing.allocation.enable": "all",
    "cluster.routing.rebalance.enable" : "all"
  }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM