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

版本: 8.7-8.9

简而言之,当Elasticsearch在指定的时间限制内无法获取分片锁时,就会发生此错误。这可能是由于大量的索引或搜索操作,或者是磁盘速度慢造成的。要解决此问题,你可以尝试通过优化索引和搜索操作来减少Elasticsearch集群的负载。你也可以考虑升级硬件,特别是磁盘I/O。此外,增加分片锁等待时间可能会有所帮助,但这也可能导致其他问题,如延迟增加。

日志上下文 #

日志"timed out while waiting to acquire shard lock for"的类名是 IndicesClusterStateService.java。我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入背景信息的人参考:

shardLockRetryTimeout;
 shardLockRetryTimeout.millis();
 shardRouting
 );
 listener.onFailure(
 new ElasticsearchTimeoutException("timed out while waiting to acquire shard lock for " + shardRouting)
 );
 return;
 }  final var indexService = indicesService.indexService(shardRouting.index());