--- title: "准备事务日志目标失败 – 如何解决此 Elasticsearch 异常" date: 2026-01-04 lastmod: 2026-01-04 description: "当 Elasticsearch 在准备事务日志(translog)目标时遇到问题,会触发此错误。可能原因包括磁盘空间不足、文件系统损坏或网络连接问题。" tags: ["事务日志", "恢复", "磁盘空间"] summary: "版本: 6.8-8.9 简而言之,当 Elasticsearch 在为事务日志(translog)准备目标时遇到问题,就会发生此错误。这可能是由于磁盘空间不足、文件系统损坏或网络连接问题造成的。要解决此问题,你可以尝试释放磁盘空间、检查文件系统是否存在错误,或排查网络连接问题。此外,确保 Elasticsearch 版本是最新的,并与你的系统兼容。如果问题仍然存在,可以考虑重新索引数据或从备份恢复。 日志上下文 # “prepare target for translog failed” 日志的类名是 RecoverySourceHandler.java. 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考: final ActionListenerwrappedListener = ActionListener.wrap(nullVal -> { stopWatch.stop(); final TimeValue tookTime = stopWatch.totalTime(); logger.trace("recovery [phase1]: remote engine start took [{}]"; tookTime); listener.onResponse(tookTime); }; e -> listener.onFailure(new RecoveryEngineException(shard.shardId(); 1; "prepare target for translog failed"; e))); // Send a request preparing the new shard's translog to receive operations. This ensures the shard engine is started and disables // garbage collection (not the JVM's GC!" --- > **版本:** 6.8-8.9 简而言之,当 Elasticsearch 在为事务日志(translog)准备目标时遇到问题,就会发生此错误。这可能是由于磁盘空间不足、文件系统损坏或网络连接问题造成的。要解决此问题,你可以尝试释放磁盘空间、检查文件系统是否存在错误,或排查网络连接问题。此外,确保 Elasticsearch 版本是最新的,并与你的系统兼容。如果问题仍然存在,可以考虑重新索引数据或从备份恢复。 日志上下文 ----------- "prepare target for translog failed" 日志的类名是 [RecoverySourceHandler.java.](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/) 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考: ```java final ActionListenerwrappedListener = ActionListener.wrap(nullVal -> { stopWatch.stop(); final TimeValue tookTime = stopWatch.totalTime(); logger.trace("recovery [phase1]: remote engine start took [{}]"; tookTime); listener.onResponse(tookTime); }; e -> listener.onFailure(new RecoveryEngineException(shard.shardId(); 1; "prepare target for translog failed"; e))); // Send a request preparing the new shard's translog to receive operations. This ensures the shard engine is started and disables // garbage collection (not the JVM's GC!) of tombstone deletes. logger.trace("recovery [phase1]: prepare remote engine for translog"); cancellableThreads.checkForCancel(); recoveryTarget.prepareForTranslogOperations(totalTranslogOps; wrappedListener); ```