Jin-Yuan Chen
Jin-Yuan Chen

Reputation: 81

ElasticSearch: How to disable shard reallocation of all shards?

I developed a search plugin for elasticsearch, but when upgrading this plugin, i need to shutdown the nodes one by one, and each time i have to wait for the reallocation process a long time. In the document, it said the reallocation process can be stopped by:

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

When I run this command, i got following error:

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

What can i do?

btw: sorry for my poor english...

Upvotes: 8

Views: 20098

Answers (2)

Hang
Hang

Reputation: 1204

OP might use an older Elasticsearch version that doesn't support updating "cluster.routing.allocation.enable" and/or "cluster.routing.rebalance.enable" dynamically.

However, on more recent Elasticsearch versions, those 2 settings should be dynamic or transient, not static or persistent any more.

Here are more details about shards-allocation settings from Elasticsearch current doc.

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

And user can apply/revoke these settings in Kibana Dev Tool Console, like these

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"
  }
}

Upvotes: 1

GlenRSmith
GlenRSmith

Reputation: 786

So close!

Try:

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

Upvotes: 7

Related Questions