TotalShardsPerNode Index setting VS cluster setting

Settings in question:
cluster.routing.allocation.total_shards_per_node
index.routing.allocation.total_shards_per_node

Actual Question:
Lets say I have multiple indices and I set index.routing.allocation.total_shards_per_node to 5.
Does that block other indices from having shards on the node?

Scenario:
Index A has index.routing.allocation.total_shards_per_node: 5
Index B has index.routing.allocation.total_shards_per_node: 5

If Node 1 has 5 shards from index A on it can it accept any from index B?

Hey,

should work, but this is one of the classic examples, where quick testing beats guessing.
You can easily test this, using the following snippet and tweaking the values

DELETE _all

PUT _cluster/settings
{
  "transient": {
    "cluster.routing.allocation.total_shards_per_node" : 1
  }
}

PUT a
{
  "settings": {
    "index.routing.allocation.total_shards_per_node" : 1,
    "number_of_shards": 2
  }
}

PUT b
{
  "settings": {
    "index.routing.allocation.total_shards_per_node" : 1,
    "number_of_shards": 2
  }
}

# this will show if the shards have been assigned or not
GET _cat/shards

hope this helps

--Alex

1 Like

Cool I'll test it out. Thanks

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.