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

版本: 6.8-8.9

简而言之,当Elasticsearch无法为分片找到有效的事务日志(translog)UUID时,会出现此错误。这可能是由于事务日志损坏或删除所致。要解决此问题,您可以尝试从备份恢复数据。如果没有可用的备份,您可能需要删除并重新创建索引。但是,这将导致数据丢失。另一个选择是使用Elasticsearch的"shrink" API从现有索引创建新索引,这可能会绕过损坏的事务日志。

日志上下文 #

日志"shard must have a valid translog UUID but got: [null]“的类名是 TruncateTranslogAction.java。我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入理解的人参考:

// Retrieve the generation and UUID from the existing data
 final MapcommitData = new HashMap<>(commits.get(commits.size() - 1).getUserData());
 final String translogUUID = commitData.get(Translog.TRANSLOG_UUID_KEY);  if (translogUUID == null) {
 throw new ElasticsearchException("shard must have a valid translog UUID but got: [null]");
 }  final boolean clean = isTranslogClean(shardPath; clusterState; translogUUID);  if (clean) {