Elasticsearch cluster.routing.allocation.balance.disk_usage Setting

Pulse - Elasticsearch Operations Done Right

On this page

Description Example Common Issues or Misuses Do's and Don'ts Frequently Asked Questions

The cluster.routing.allocation.balance.disk_usage setting in Elasticsearch controls the weight of disk usage in the cluster balancing algorithm. This setting influences how aggressively Elasticsearch will attempt to balance shards across nodes based on disk usage.

Description

  • Default value: 100.0
  • Possible values: Any positive float value
  • Recommendation: Keep the default unless you have specific reasons to adjust it

This setting is part of a group of balance settings that control how Elasticsearch allocates and balances shards across the cluster. A higher value for disk_usage means that Elasticsearch will give more importance to balancing disk usage across nodes when allocating shards.

Example

To change the cluster.routing.allocation.balance.disk_usage setting using the cluster settings API:

PUT _cluster/settings
{
  "transient": {
    "cluster.routing.allocation.balance.disk_usage": 150.0
  }
}

Increasing this value might be beneficial in clusters where disk usage is a critical factor, such as when nodes have limited disk space or when you want to ensure more even distribution of data across nodes.

Common Issues or Misuses

  • Setting this value too high may lead to excessive shard movements, potentially impacting cluster performance.
  • Ignoring this setting entirely might result in uneven disk usage across nodes, potentially leading to disk space issues on some nodes.

Do's and Don'ts

  • Do monitor disk usage across your cluster nodes regularly.
  • Do adjust this setting in small increments and observe the effects before making further changes.
  • Don't set this value extremely high without understanding the potential impact on cluster performance.
  • Don't ignore disk usage imbalances in your cluster, as they can lead to performance issues and potential data loss.

Frequently Asked Questions

Q: How does the disk_usage setting interact with other balance settings?
A: The disk_usage setting works in conjunction with other balance settings like shard_count and primary_balance to determine the overall shard allocation strategy. Elasticsearch uses a weighted formula that considers all these factors.

Q: Can changing this setting cause immediate shard relocation?
A: Yes, if the new value results in a significant imbalance according to the allocation algorithm, it may trigger shard relocations to achieve better balance.

Q: How often does Elasticsearch check and apply this balance setting?
A: Elasticsearch continuously evaluates cluster balance and applies these settings during shard allocation decisions, which can happen during index creation, node addition/removal, or periodic rebalancing operations.

Q: Is it safe to set this value to 0?
A: Setting it to 0 would effectively disable disk usage consideration in shard balancing, which is not recommended as it could lead to severe disk usage imbalances across nodes.

Q: How can I determine if I need to adjust this setting?
A: Monitor your cluster's disk usage patterns and shard distribution. If you notice consistent imbalances despite having available disk space on some nodes, you might consider adjusting this setting.

Subscribe to the Pulse Newsletter

Get early access to new Pulse features, insightful blogs & exclusive events , webinars, and workshops.