【问题标题】:Increasing the size of the queue in Elasticsearch?增加 Elasticsearch 中队列的大小?
【发布时间】:2020-05-19 15:32:11
【问题描述】:

我一直在查看我的 elasticsearch 日志,我遇到了错误

rejected execution (queue capacity 1000) on org.elasticsearch.search.action.SearchServiceTransportAction$23@6d32fa18

查找错误后,一般和共识是增加队列的大小,如这里所说 - https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-threadpool.html

我的问题是我该怎么做?是否有我缺少的配置文件?

【问题讨论】:

  • 在少数情况下,这是建议。在大多数其他情况下,需要查看为什么集群无法处理大量搜索请求。集群在其他方面是否过于过载?集群是否过小?等
  • 很可能两者兼而有之。大部分的设置还是默认的,都是在生产服务器上运行的,所以需要配置很多东西
  • 不,你错了。仅仅因为这些设置是默认设置,这并不意味着它们需要进行配置。 ES 中的默认值通常适用于大多数场景。
  • 也许吧。我遇到的问题是,在 kibana 仪表板运行良好几周后,发送的新日志停止出现,所以我认为 Elastisearch 已经超载。大多数在线指南似乎都说增加堆大小也非常重要。

标签: exception elasticsearch


【解决方案1】:

从 Elasticsearch 5 开始,您无法使用 API 更新线程池搜索队列大小。现在是节点级别的设置。见this

线程池设置现在是节点级设置。因此,无法通过集群设置 API 更新线程池设置。

要更新线程池,您必须在每个节点的elasticsearch.yml文件中添加thread_pool.search.queue_size : <New size>,然后重新启动elasticsearch。

【讨论】:

  • 我如何从 docker-compose.yml 做同样的事情?
  • @blueren 像这样:``` 环境: - thread_pool.search.queue_size=100 - thread_pool.write.queue_size=1000 ``` 或者通过自定义配置文件(参见 elasticsearch docker docs您使用的版本)。 (好吧,格式中断了,但我希望你能明白!)
【解决方案2】:

要更改队列大小,可以将其添加到每个节点的配置文件中,如下所示:

threadpool.search.queue_size: <new queue size>.

不过,这也需要重新启动集群。

在 Elasticsearch 2.x 之前,您可以通过 cluster-setting api 进行更新,这不需要重新启动集群,但是 Elasticsearch 5.x 和更高版本没有此选项。

curl -XPUT  _cluster/settings -d '{
    "persistent" : {
        "threadpool.search.queue_size" : <new_size>
    }
}'

您可以按如下方式查询队列大小:

curl &lt;server&gt;/_cat/thread_pool?v&amp;h=search.queueSize

【讨论】:

【解决方案3】:

从 Elasticsearch 6 开始,搜索线程池的类型已更改为 fixed_auto_queue_size,这意味着在 elasticsearch.yml 中设置 threadpool.search.queue_size 是不够的,您还必须控制 min_queue_sizemax_queue_size 参数,像这样:

thread_pool.search.queue_size: <new_size>
thread_pool.search.min_queue_size: <new_size>
thread_pool.search.max_queue_size: <new_size>

我建议在进行任何更改之前使用_cluster/settings?include_defaults=true 查看节点中的当前线程池设置。更多关于fixed_auto_queue_size线程池的信息read the docs.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-14
    • 1970-01-01
    相关资源
    最近更新 更多