📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

版本: 6.8-8.9

简而言之,当 Elasticsearch 由于磁盘空间不足、网络连接问题或数据损坏等问题而无法为恢复准备分片时,就会发生此错误。要解决此问题,您可以尝试释放磁盘空间、检查网络连接,或从备份恢复分片。如果分片已损坏且没有备份,您可能需要删除并重新创建它。此外,确保 Elasticsearch 集群健康状况为绿色,并且所有节点都正常运行。

日志上下文 #

日志 “failed to prepare shard for recovery” 类名是 PeerRecoveryTargetService.java. 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:

final var cleanupOnly = ActionListener.notifyOnce(ActionListener.runBefore(ActionListener.noop().delegateResponse((l; e) -> {
 // this will be logged as warning later on...
 logger.trace("unexpected error while preparing shard for peer recovery; failing recovery"; e);
 onGoingRecoveries.failRecovery(
 recoveryId;
 new RecoveryFailedException(recoveryTarget.state(); "failed to prepare shard for recovery"; e);
 true
 );
 }); onCompletion::close));  if (indexShard.routingEntry().isPromotableToPrimary() == false) {