Courier Fetch:分片失败

Courier Fetch: shards failed

为什么我在向 elasticsearch 添加更多数据后会收到这些警告? 每次浏览仪表板时警告都不同。

"Courier Fetch: 30 of 60 shards failed."

更多详情:

它是 CentOS 7.1 上的唯一节点

/etc/elasticsearch/elasticsearch.yml

index.number_of_shards: 3
index.number_of_replicas: 1

bootstrap.mlockall: true

threadpool.bulk.queue_size: 1000
indices.fielddata.cache.size: 50%
threadpool.index.queue_size: 400
index.refresh_interval: 30s

index.number_of_shards: 5
index.number_of_replicas: 1

/usr/share/elasticsearch/bin/elasticsearch.in.sh

ES_HEAP_SIZE=3G

#I use this Garbage Collector instead of the default one.

JAVA_OPTS="$JAVA_OPTS -XX:+UseG1GC"

集群状态

{
  "cluster_name" : "my_cluster",
  "status" : "yellow",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 61,
  "active_shards" : 61,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 61
}

集群详细信息

{
  "cluster_name" : "my_cluster",
  "nodes" : {
    "some weird number" : {
      "name" : "ES 1",
      "transport_address" : "inet[localhost/127.0.0.1:9300]",
      "host" : "some host",
      "ip" : "150.244.58.112",
      "version" : "1.4.4",
      "build" : "c88f77f",
      "http_address" : "inet[localhost/127.0.0.1:9200]",
      "process" : {
        "refresh_interval_in_millis" : 1000,
        "id" : 7854,
        "max_file_descriptors" : 65535,
        "mlockall" : false
      }
    }
  }
}

我很好奇 "mlockall" : false 因为在 yml 上我确实写了 bootstrap.mlockall: true

日志

很多行,例如:

org.elasticsearch.common.util.concurrent.EsRejectedExecutionException: rejected execution (queue capacity 1000) on org.elasticsearch.search.action.SearchServiceTransportAction@a9a34f5

这可能表明您的集群的运行状况存在问题。在不了解您的集群的情况下,没有太多可以说的了。

对我来说,调整线程池搜索 queue_size 解决了这个问题。我尝试了很多其他方法,这是解决问题的方法。

我已将此添加到我的 elasticsearch.yml

threadpool.search.queue_size: 10000

然后重启elasticsearch。

推理...(来自文档)

A node holds several thread pools in order to improve how threads memory consumption are managed within a node. Many of these pools also have queues associated with them, which allow pending requests to be held instead of discarded.

特别是搜索...

For count/search operations. Defaults to fixed with a size of int((# of available_processors * 3) / 2) + 1, queue_size of 1000.

更多信息可以参考elasticsearchdocs here...

我找不到这些信息,希望这对其他人有帮助!

同意@Philip的观点,但是至少在Elasticsearch>=1.5.2上需要重启elasticsearch,因为可以动态设置threadpool.search.queue_size.

curl -XPUT http://your_es:9200/_cluster/settings
{
    "transient":{
        "threadpool.search.queue_size":10000
    }
}

使用 Elasticsearch 5.4 thread_pool 有下划线。

thread_pool.search.queue_size: 10000

请参阅 Elasticsearch Thread Pool module documentation

处的文档

从 Elasticsearch >= 版本 5 开始,无法使用 _cluster/settings API 更新 thread_pool.search.queue_size 的集群设置。在我的例子中,更新 ElasticSearch 节点 yml 文件也不是一个选项,因为如果节点失败,那么自动缩放代码会给其他 ES 节点带来默认的 yml 设置。

我有一个有 3 个节点的集群,有 400 个活动的主分片和 7 个活动线程,队列大小为 1000。将具有类似配置的节点数量增加到 5 已经解决了这个问题,因为查询正在水平分布以提供更多可用节点。

当我的查询缺少结束引号时出现此错误:

field:"value

在我的 ElasticSearch 日志中,我看到了这些异常:

Caused by: org.elasticsearch.index.query.QueryShardException:
    Failed to parse query [field:"value]
...
Caused by: org.apache.lucene.queryparser.classic.ParseException: 
    Cannot parse 'field:"value': Lexical error at line 1, column 13.  
    Encountered: <EOF> after : "\"value"

这不适用于 elasticsearch 5.6。

{
"error": {
    "root_cause": [
        {
            "type": "remote_transport_exception",
            "reason": "[colmbmiscxx.xx][172.29.xx.xx:9300][cluster:admin/settings/update]"
        }
    ],
    "type": "illegal_argument_exception",
    "reason": "transient setting [threadpool.search.queue_size], not dynamically updateable"
},
"status": 400

}