Search code examples
elasticsearch

Scaling down ElasticSearch: what happens with closed indices?


To scale down ElasticSearch, I usually disable allocation on a node, wait for shards to relocate, and then remove the node, e.g.:

curl -X PUT "localhost:9200/_cluster/settings" -d'{
  "transient" : {
    "cluster.routing.allocation.exclude._name" : "node-4"
  }
}'

As I understand, open indices' shards will be relocated to other nodes... but what happens to closed indices?

A closed index is, per my understanding, ignored on snapshots... so it makes me think if it will be ignored when setting an allocation exclusion as well.

After excluding allocation to a node, I went to check its disk usage... and it seems like it still has a lot of things there:

$ du -hs /usr/share/elasticsearch/nodes/0/
131G    /usr/share/elasticsearch/nodes/0/

So, my questions are:

  • What happens to closed indices when I exclude a node from allocation?
  • How safe it is to do this if I don't want to loose those closed indices (for whatever reason)?

Solution

  • As far as I could understand:

    • What happens to closed indices when I exclude a node from allocation?

    Nothing happens, they are kept on the node being excluded.

    • How safe it is to do this if I don't want to loose those closed indices (for whatever reason)?

    Unsafe. Data might be lost when you permanently delete the node (i.e. terminate the machine and its storage).