SearchContextMissingException无法执行获取阶段[search/phase/fetch/id]

Aru*_*ash 5 java elasticsearch


Cluser:我正在使用elasticsearch 1.3.1,在不同的服务器中有6个节点,这些服务器都通过LAN连接.带宽很高,每个带有45 GB RAM.

配置我们为要运行的节点分配的堆大小为10g.除了唯一的discoverym,集群名称,节点名称和我们2区域之外,我们确实有elasticsearch默认配置.3节点属于一个区域,另一个属于另一个区域.

指数:15,指数总量为76GB.

现在,我正面临着SearchContextMissingExceptionDEBUG日志的异常.它闻起来像一些搜索查询花了很多时间来获取.但我检查了查询,没有查询产生大量的负载...我想知道为什么会发生这种情况.

问题:由于这个问题逐个所有节点开始收集GC.并导致OOM :(

这是我的例外.请帮我解释一下2件事.

  1. 什么是SearchContextMissingException?为什么会这样?
  2. 我们如何防止这些类型的查询群集?

错误:

[YYYY-MM-DD HH:mm:ss,039][DEBUG][action.search.type ] [es_node_01] [5031530] 
   Failed to execute fetch phase 
   org.elasticsearch.transport.RemoteTransportException: [es_node_02][inet[/1x.x.xx.xx:9300]][search/phase/fetch/id] 
   Caused by: org.elasticsearch.search.SearchContextMissingException: No search context found for id [5031530] 
       at org.elasticsearch.search.SearchService.findContext(SearchService.java:480) 
       at org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:450) 
       at org.elasticsearch.search.action.SearchServiceTransportAction$SearchFetchByIdTransportHandler.messageReceived(SearchServiceTransportAction.java:793) 
       at org.elasticsearch.search.action.SearchServiceTransportAction$SearchFetchByIdTransportHandler.messageReceived(SearchServiceTransportAction.java:782) 
       at org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.run(MessageChannelHandler.java:275) 
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) 
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 
       at java.lang.Thread.run(Thread.java:722)
Run Code Online (Sandbox Code Playgroud)

Jil*_*urp 0

如果可以的话,请更新到 1.4.2。它修复了一些已知的弹性问题,包括您所描述的级联故障。

不管怎样,默认配置肯定会给你带来麻烦。至少,您可能需要考虑为字段数据缓存等设置断路器。

这是从我们的生产配置中摘取的片段。我假设您还正确配置了 linux 文件句柄限制:请参阅此处

# prevent swapping
bootstrap.mlockall: true

indices.breaker.total.limit: 70%
indices.fielddata.cache.size: 70%

# make elasticsearch work harder to migrate/allocate indices on startup (we have a lot of shards due to logstash); default was 2
cluster.routing.allocation.node_concurrent_recoveries: 8

# enable cors
http.cors.enabled: true
http.cors.allow-origin: /https?:\/\/(localhost|kibana.*\.linko\.io)(:[0-9]+)?/

index.query.bool.max_clause_count: 4096
Run Code Online (Sandbox Code Playgroud)

  • `SearchContextMissionException` 是由于无效的滚动 ID 造成的。当您扫描文档时,它将返回一个新的滚动 ID,您需要为下一个请求传递新的滚动 ID。一旦检索到所有文档,我们就会遇到此异常。 (2认同)