Servers

Elasticsearch cluster stops relocating shards after index.routing.allocation.exclude set incorrectly

Environment

Environment

Elasticsearch 7.9.3 cluster (3 master/data nodes on EC2) with multiple hot indices. Operator recently set index-level allocation exclude to decommission a node using dynamic cluster API.

Symptoms

Symptoms

Several primary shards remain UNASSIGNED after the exclude; cluster health turns yellow and some shards show 'cannot allocate because allocation is disabled by settings' in allocation explain. No node failures are shown; disk usage is healthy per df -h.

Observations

Observations

GET _cluster/allocation/explain returns 'allocation filtering: no nodes match the required criteria'. Cluster settings show index.routing.allocation.exclude._name=<node-name-pattern> applied to multiple indices; cluster.routing.allocation.enable is set to 'all'. No snapshots in progress. Attempting to set allocation enable to 'primaries' did not reassign.

Already attempted

Already attempted

Tried clearing index-level exclude via update settings API and forced reroute but shards stayed unassigned. Restarted a data node to force rejoin; cluster state unchanged. No recent mapping or template changes.

Question

Question

What are the correct steps to restore shard allocation safely without data loss; what cluster settings can silently block allocation even when disk and nodes look healthy?

COMMUNITY RESPONSES

Verified community troubleshooting

0 replies

No answers yet..

Showing 0 of 0 community responses
AI DIAGNOSTICS

Incident analysis

Updated 1mo ago• Trouble ID

Most likely causes

Index-level allocation exclude removed all eligible target nodes (exclude pattern too broad), preventing any allocation 80%
Cluster-level allocation disabled or set to a restrictive value (cluster.routing.allocation.enable=none) preventing relocation 50%
Disk-based decider (low/high watermark) blocking allocation due to misreported free space or container filesystem showing inflated free space 40%

Summary

The allocation explain output shows the exclude filter removed eligible nodes, causing unassigned primaries. Even when cluster.routing.allocation.enable is 'all', index-level routing filters can prevent allocation. Other blockers include 'cluster.routing.allocation.exclude' left as a persistent transient setting, or index.block settings (index.blocks.write or blocks.metadata) or leftover shard allocation deciders like disk watermarks or allocation filtering at cluster level. A safe path is to examine current allocation filters, clear accidental excludes, and use reroute API or set allocation enable to 'all'. If primaries are gone and no replicas exist, recovery requires restoring from snapshot or re-adding original node.

Suggested Fixes

Diagnostic step 1
Run GET _cluster/allocation/explain for a specific unassigned shard to read the exact allocator decision.
Diagnostic step 2
Inspect index and cluster allocation settings: GET /_cluster/settings?include_defaults=true and GET /<index>/_settings for index.routing.* and index.blocks.*.
Diagnostic step 3
If an exclude is too broad, clear it: PUT /<index>/_settings {"index.routing.allocation.exclude._name": null} (or use empty string) for affected indices. Do this for a small set of indices first.

Continue troubleshooting

Matched from the title, description and tags