The indices.recovery.max_bytes_per_sec
setting in Elasticsearch controls the maximum bandwidth allowed for shard recovery operations. This setting helps manage the network traffic and I/O load during shard recovery processes, such as initial recovery, relocation, or snapshot restoration.
- Default Value: 40mb
- Possible Values: Any byte size value (e.g., 50mb, 500mb, 1gb)
- Recommendations: The optimal value depends on your network capacity, storage performance, and recovery priorities. Increase for faster recovery times, decrease to reduce network and I/O load.
This setting is cluster-wide but can be overridden on a per-node basis. It's been available since early versions of Elasticsearch and continues to be supported in current versions.
Example
To change the maximum recovery bandwidth to 100MB/s using the cluster settings API:
PUT _cluster/settings
{
"persistent": {
"indices.recovery.max_bytes_per_sec": "100mb"
}
}
Reasons for changing this setting might include:
- Speeding up recovery processes in a high-bandwidth environment
- Reducing network congestion in a shared or limited bandwidth scenario
- Balancing recovery speed with ongoing indexing and search operations
Common Issues and Misuses
- Setting the value too high can overwhelm network resources and impact cluster performance
- Setting it too low can significantly extend recovery times, potentially affecting cluster stability
- Forgetting to adjust this setting when upgrading network infrastructure, leading to underutilized resources
Do's and Don'ts
- Do monitor recovery times and adjust this setting accordingly
- Do consider your network capacity and storage performance when setting this value
- Don't set this value arbitrarily high without considering the impact on your cluster and network
- Don't ignore this setting when planning for disaster recovery scenarios
- Do test different values in a non-production environment before applying to production
Frequently Asked Questions
Q: How does this setting affect snapshot restore operations?
A: This setting limits the bandwidth for all recovery operations, including snapshot restores. A higher value can speed up restore operations, but may impact other cluster operations.
Q: Can I change this setting dynamically?
A: Yes, you can change this setting dynamically using the cluster settings API without restarting nodes.
Q: How do I determine the optimal value for my cluster?
A: Monitor recovery times, network utilization, and cluster performance during recovery operations. Start with the default and adjust based on your specific needs and infrastructure capabilities.
Q: Does this setting apply to both primary and replica shard recoveries?
A: Yes, this setting applies to all types of shard recoveries, including primary shard initialization and replica shard synchronization.
Q: Can this setting be overridden for specific indices?
A: No, this is a cluster-level setting. However, you can set it on a per-node basis if needed, which can indirectly affect specific indices depending on shard allocation.