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

版本: 7.11-8.9

简要来说,当Elasticsearch由于[.watches]索引未分配而无法管理集群告警时,会出现此错误。该索引用于存储监控器数据,其不可用会中断告警管理。要解决此问题,您可以尝试使用reroute API手动分配索引。另外,确保集群中有足够的节点和磁盘空间用于分配。同时,检查是否存在可能阻止分配的硬件故障或网络分区。最后,调整索引设置或集群设置可能有助于索引分配。

日志上下文 #

日志"cannot manage cluster alerts because [.watches] index is not allocated"的类名是 LocalExporter.java。 我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入了解上下文的人参考:

final IndexRoutingTable watches = clusterState.routingTable().index(Watch.INDEX);
 final boolean indexExists = watches != null && watches.allPrimaryShardsActive();  // we cannot do anything with watches until the index is allocated; so we wait until it's ready
 if (watches != null && watches.allPrimaryShardsActive() == false) {
 errors.add(new ElasticsearchException("cannot manage cluster alerts because [.watches] index is not allocated"));
 logger.trace("cannot manage cluster alerts because [.watches] index is not allocated");
 } else if ((watches == null || indexExists) && watcherSetup.compareAndSet(false; true)) {
 addClusterAlertsRemovalAsyncActions(indexExists; asyncActions; pendingResponses; setupListener; errors);
 }
 } else {