Configuring Automatic Retry for Failed Shard Allocation
As an Elasticsearch cluster runs, shard allocation may fail due to factors such as high node load or a triggered circuit breaker. After a shard allocation failure, the system automatically retries the allocation. However, once the number of retries reaches the configured limit, the shard remains in the unassigned state and is no longer considered for reallocation. This may prevent read and write requests for the affected index from being processed properly. Normally, after this occurs, you can only retry the allocation manually by calling the Reroute API (/_cluster/reroute?retry_failed=true). This not only increases the operational burden, but also means that hours or even days may pass before manual intervention, preventing temporary failures from recovering automatically. CSS provides automatic retry for failed shard allocation. Once a shard reaches its maximum allocation failure limit, the system periodically retries allocation using an exponential backoff strategy, enabling self-healing without manual intervention.
How the Feature Works
After automatic retry for failed shard allocation is enabled, the system automatically retries shards whose number of allocation failures has reached the retry limit. The limit is controlled by index.allocation.max_retries and defaults to 5. The retry process is as follows:
- Automatic retries start after the base delay.
- If a retry succeeds, the shard is no longer tracked. If the retry fails, the backoff delay is doubled before the next retry.
- Once the backoff delay reaches the configured maximum delay, it no longer increases. Subsequent retries are performed at the maximum delay.
- The system periodically checks for failed shards that need to be retried at the configured polling interval. If any are found, they are retried.
| Retry Count | Backoff Delay | Description |
|---|---|---|
| 0 | 1m | Shard is detected for the first time. The retry is allowed to proceed after the base delay. |
| 1 | 2m | The first retry fails. The backoff delay is doubled. |
| 2 | 4m | The second retry fails. |
| 3 | 8m | The third retry fails. |
| 4 | 16m | The fourth retry fails. |
| ... | ... | The delay continues to double until it reaches the maximum delay. |
| N | 120m | The maximum delay is reached. Subsequent retries are performed at the maximum delay. |
Constraints
Automatic retry for failed shard allocation is supported only for Elasticsearch 7.10.2 clusters (image version 7.10.2_26.6.0_xxx or later). The feature is enabled by default for clusters that meet these version requirements.
Logging In to Kibana
Log in to Kibana and go to the command execution page. Elasticsearch clusters support multiple access methods. This topic uses Kibana as an example to describe the operation procedures.
- Log in to the CSS management console.
- In the navigation pane on the left, choose Clusters > Elasticsearch.
- In the cluster list, find the target cluster, and click Kibana in the Operation column to log in to the Kibana console.
- In the left navigation pane, choose Dev Tools.
The left part of the console is the command input box, and the triangle icon in its upper-right corner is the execution button. The right part shows the execution result.
Configuring Automatic Retry Parameters for Failed Shard Allocation
You can dynamically configure the parameters for automatic retry of failed shard allocation. The changes take effect immediately after configuration.
- Enable or disable automatic retry for failed shard allocation.
PUT _cluster/settings { "persistent": { "cluster.routing.allocation.retry_failed.auto_enabled": true } }Table 2 Parameter for enabling or disabling automatic retry for failed shard allocation Parameter
Type
Default Value
Description
cluster.routing.allocation.retry_failed.auto_enabled
Boolean
true
Enables or disables automatic retry for failed shard allocation.
The value can be:
- true: Enables automatic retry.
- false: Disables automatic retry. After automatic retry is disabled, shards whose number of allocation failures reaches the retry limit remain in the unassigned state and must be retried manually using the Reroute API, which may result in prolonged service interruption. It is recommended that you disable this feature only when automatic recovery is not required for your cluster.
- Configure the exponential backoff parameters that control the retry interval and frequency.
PUT _cluster/settings { "persistent": { "cluster.routing.allocation.retry_failed.auto_base_delay": "1m", "cluster.routing.allocation.retry_failed.auto_max_delay": "120m", "cluster.routing.allocation.retry_failed.auto_poll_interval": "5m" } }Table 3 Exponential backoff parameters Parameter
Type
Default Value
Description
cluster.routing.allocation.retry_failed.auto_base_delay
TimeValue
1m
Base delay for the backoff strategy. This specifies the initial wait time before the first automatic retry. After each failed retry, the delay doubles.
Value range: 1m–1440m
Format: number + unit. Supported units: ms (milliseconds), s (seconds), m (minutes), h (hours), and d (days).
cluster.routing.allocation.retry_failed.auto_max_delay
TimeValue
120m
Maximum delay for the backoff strategy. Once the retry interval reaches this value, it no longer increases, preventing the backoff delay from growing indefinitely.
Value range: 1m–1440m
Format: number + unit. Supported units: ms (milliseconds), s (seconds), m (minutes), h (hours), and d (days).
cluster.routing.allocation.retry_failed.auto_poll_interval
TimeValue
5m
Polling interval. The system periodically checks for shards that have exceeded the retry limit, ensuring that shards are not missed when the cluster state remains stable.
Value range: 1m–1440m
Format: number + unit. Supported units: ms (milliseconds), s (seconds), m (minutes), h (hours), and d (days).
It is recommended that you keep the default value. A smaller value increases the polling frequency and may have a slight impact on cluster performance. A larger value may delay the detection of shards that need to be retried.
- (Optional) Verify the configuration. Query the current automatic retry configuration for failed shard allocation:
GET _cluster/settings?filter_path=**.retry_failed.auto_*
If the returned result contains the configured parameters and their values match the configured values, the configuration has taken effect.
FAQ
- Q1: How do I manually retry failed shard allocation after disabling automatic retry?
After automatic retry is disabled, you can manually retry failed shard allocation by calling the Reroute API:
POST /_cluster/reroute?retry_failed=true
- Q2: Does automatic retry for failed shard allocation affect ongoing shard allocation?
No. Automatic retry only allocates shards that have reached the index.allocation.max_retries limit and are now in the unassigned state. It does not trigger Move or Balance operations and therefore does not affect ongoing shard allocation.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot