Trying to recover when the shard is in backup state – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-8.9

Briefly, this error occurs when Elasticsearch attempts to recover a shard that is currently in a backup state. This could be due to a failed node, network issues, or disk failures. To resolve this issue, you can try restarting the Elasticsearch node, checking the network connectivity, or inspecting the disk for any failures. If the problem persists, you may need to manually force a shard reallocation or restore the shard from a backup.

This guide will help you check for common problems that cause the log ” Trying to recover when the shard is in backup state ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: shard, index.

Log Context

Log “Trying to recover when the shard is in backup state” class name is StoreRecovery.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 if (indexShard.state() == IndexShardState.CLOSED) {
 // got closed on us; just ignore this recovery
 return false;
 }
 if (indexShard.routingEntry().primary() == false) {
 throw new IndexShardRecoveryException(shardId; "Trying to recover when the shard is in backup state"; null);
 }
 return true;
 }  private ActionListener recoveryListener(IndexShard indexShard; ActionListener listener) {

 

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?