Elasticsearch Enable Shard Rebalance and Shard Allocation



Elasticsearch Enable Shard Rebalance and Shard Allocation

Opster Team

July 2020, Version: 1.7-8.0


Before you begin reading the explanation below, try running the free ES Health Check-Up get actionable recommendations that can improve Elasticsearch performance and prevent serious incidents. Just 2 minutes to complete and you can check your threadpools, memory, snapshots and many more

What does it mean?

Cluster shard rebalancing and allocation are often confused with each other.

Cluster shard allocation

This refers to the process by which any shard including new, recovered or rebalanced shards are allocated to Elasticsearch nodes. Cluster shard allocation may be temporarily disabled during maintenance in order to avoid shards from being relocated to nodes which are being restarted and may temporarily leave the cluster.

If cluster shard allocation is NOT enabled, then Elasticsearch will not be able to create new indices, recover corrupted indices or rebalance. This situation is very likely to cause data loss if not corrected quickly.

Cluster shard rebalancing

This refers to the process by which an Elasticsearch cluster may rebalance shards from nodes with high disk utilization (above the value of cluster.routing.allocation.disk.watermark.high) to nodes with lower disk utilisation, or redistribute shards from pre-existing nodes to a new node which has just been added to the cluster.  

If cluster shard rebalancing is not enabled, then Elasticsearch will not be able to optimize disk and cpu utilization across the cluster by rebalancing shards from heavily used nodes to underused nodes. 

How to resolve it

The default values are the recommended ones for both of these settings. To restore the default value run the following command:

PUT _cluster/settings
{
  "transient": {
     "cluster.routing.allocation.enable": "all",

     "cluster.routing.rebalance.enable": "all"
  }
}


About Opster

Opster detects, prevents, optimizes and automates everything needed to run mission-critical Elasticsearch

Find Configuration Errors

Analyze Now