Total number of shards for an index on a single node exceeded

edit

Total number of shards for an index on a single node exceeded

edit

Elasticsearch tries to take advantage of all the available resources by distributing data (index shards) among nodes in the cluster.

Users might want to influence this data distribution by configuring the index.routing.allocation.total_shards_per_node index setting to a custom value (for e.g. 1 in case of a highly trafficked index). Various configurations limiting how many shards an index can have located on one node can lead to shards being unassigned due to the cluster not having enough nodes to satisfy the index configuration.

In order to fix this follow the next steps:

In order to get the shards assigned we’ll need to increase the number of shards that can be collocated on a node. We’ll achieve this by inspecting the configuration for the index.routing.allocation.total_shards_per_node index setting and increasing the configured value for the indices that have shards unassigned.

Use Kibana

  1. Log in to the Elastic Cloud console.
  2. On the Elasticsearch Service panel, click the name of your deployment.

    If the name of your deployment is disabled your Kibana instances might be unhealthy, in which case please contact Elastic Support. If your deployment doesn’t include Kibana, all you need to do is enable it first.

  3. Open your deployment’s side navigation menu (placed under the Elastic logo in the upper left corner) and go to Dev Tools > Console.

    Kibana Console
  4. Inspect the index.routing.allocation.total_shards_per_node index setting for the index with unassigned shards:

    GET /my-index-000001/_settings/index.routing.allocation.total_shards_per_node?flat_settings

    The response will look like this:

    {
      "my-index-000001": {
        "settings": {
          "index.routing.allocation.total_shards_per_node": "1" 
        }
      }
    }

    Represents the current configured value for the total number of shards that can reside on one node for the my-index-000001 index.

  5. Increase the value for the total number of shards that can be assigned on one node to a higher value:

    PUT /my-index-000001/_settings
    {
      "index" : {
        "routing.allocation.total_shards_per_node" : "2" 
      }
    }

    The new value for the total_shards_per_node configuration for the my-index-000001 index is increased from the previous value of 1 to 2. The total_shards_per_node configuration can also be set to -1, which represents no upper bound with regards to how many shards of the same index can reside on one node.