Peer recovery syncs data from a primary shard to a new or existing shard copy.
Peer recovery automatically occurs when Elasticsearch:
- Recreates a shard lost during node failure
- Relocates a shard to another node due to a cluster rebalance or changes to the shard allocation settings
You can view a list of in-progress and completed recoveries using the cat recovery API.
(Dynamic) Limits total inbound and outbound recovery traffic for each node. Applies to both peer recoveries as well as snapshot recoveries (i.e., restores from a snapshot). Defaults to
40mbunless the node is a dedicated cold or frozen node, in which case the default relates to the total memory available to the node:
Total memory Default recovery rate on cold and frozen nodes
≤ 4 GB
> 4 GB and ≤ 8 GB
> 8 GB and ≤ 16 GB
> 16 GB and ≤ 32 GB
> 32 GB
This limit applies to each node separately. If multiple nodes in a cluster perform recoveries at the same time, the cluster’s total recovery traffic may exceed this limit.
If this limit is too high, ongoing recoveries may consume an excess of bandwidth and other resources, which can destabilize the cluster.
This is a dynamic setting, which means you can set it in each node’s
elasticsearch.ymlconfig file and you can update it dynamically using the cluster update settings API. If you set it dynamically then the same limit applies on every node in the cluster. If you do not set it dynamically then you can set a different limit on each node, which is useful if some of your nodes have better bandwidth than others. For example, if you are using Index Lifecycle Management then you may be able to give your hot nodes a higher recovery bandwidth limit than your warm nodes.
Expert peer recovery settingsedit
You can use the following expert setting to manage resources for peer recoveries.
(Dynamic, Expert) Number of file chunks sent in parallel for each recovery. Defaults to
You can increase the value of this setting when the recovery of a single shard is not reaching the traffic limit set by
indices.recovery.max_bytes_per_sec, up to a maximum of
(Dynamic, Expert) Number of operations sent in parallel for each recovery. Defaults to
Concurrently replaying operations during recovery can be very resource-intensive and may interfere with indexing, search, and other activities in your cluster. Do not increase this setting without carefully verifying that your cluster has the resources available to handle the extra load that will result.
(Dynamic, Expert) Enables snapshot-based peer recoveries.
This feature is designed for indirect use by Elasticsearch Service. Direct use is not supported. Elastic reserves the right to change or remove this feature in future releases without prior notice.
Elasticsearch recovers replicas and relocates primary shards using the peer recovery process, which involves constructing a new copy of a shard on the target node. When
falseElasticsearch will construct this new copy by transferring the index data from the current primary. When this setting is
trueElasticsearch will attempt to copy the index data from a recent snapshot first, and will only copy data from the primary if it cannot identify a suitable snapshot. Defaults to
Setting this option to
truereduces your operating costs if your cluster runs in an environment where the node-to-node data transfer costs are higher than the costs of recovering data from a snapshot. It also reduces the amount of work that the primary must do during a recovery.
Additionally, repositories having the setting
use_for_peer_recovery=truewill be consulted to find a good snapshot when recovering a shard. If none of the registered repositories have this setting defined, index files will be recovered from the source node.
(Dynamic, Expert) Number of snapshot file downloads requests sent in parallel to the target node for each recovery. Defaults to
Do not increase this setting without carefully verifying that your cluster has the resources available to handle the extra load that will result.