Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove shard allocation filter

I have set a shard allocation filter like:

    PUT _cluster/settings
{
  "transient" : {
    "cluster.routing.allocation.exclude._name" : "node-1"
  }
}

How can I remove or disable such a setting? I tried with include, but then I have both filter setted - include and exclude. I can set something like "cluster.routing.allocation.exclude._name" : "".

But is it also possible to set something like: include all nodes?

like image 390
CPA Avatar asked Mar 01 '17 13:03

CPA


People also ask

What is shard allocation in Elasticsearch?

Shard allocation, which is an algorithm by which Elasticsearch decides which unallocated shards should go on which nodes, Shard rebalancing, which is the process of moving a shard from one node to another.

How do I reduce shard count in Elasticsearch?

If you're using time-based index names, for example daily indices for logging, and you don't have enough data, a good way to reduce the number of shards would be to switch to a weekly or a monthly pattern. You can also group old read-only indices., by month, quarter or year.

What does unassigned shards mean?

When we create index, or have one of our nodes crashed, shards may go into unassigned state. Meaning, data is there but it is not assigned/replicated to a node to enable processing that shard.


3 Answers

Have you tried

PUT _cluster/settings
{
  "transient" : {
    "cluster.routing.allocation.exclude._name" : null
  }
}

Sounds dumb, but I think that's how you unset things in elasticsearch...

like image 155
Paulin Trognon Avatar answered Oct 18 '22 01:10

Paulin Trognon


For the clusters running on Elasticsearch 5.x, you can pass null values to reset a setting. As said in this issue, this is documented for cluster level settings but not for the index level settings.

So you can do:

PUT _cluster/settings
{
   "transient" : {
       "cluster.routing.allocation.exclude._name" : null
   }
}

And also:

PUT test-index/_settings
{
  "index": {
    "routing": {
      "allocation": {
        "include": {
          "box_type": null
        },
        "exclude": {
          "box_type": null
        },
        "require": {
          "box_type": null
        },
        "total_shards_per_node": "2"
      }
    }
  }
}
like image 36
Timost Avatar answered Oct 18 '22 00:10

Timost


To reset the include filter and include all nodes, you have to use both settings:

PUT _cluster/settings
{
  "transient" : {
    "cluster.routing.allocation.include._name" : ""
  }
}

and

PUT _cluster/settings
{
   "transient" : {
     "cluster.routing.allocation.exclude._name" : ""
   }
}
like image 27
CPA Avatar answered Oct 17 '22 23:10

CPA