首页 > 解决方案 > 显示和更改参数 threadpool.bulk.queue_size

问题描述

我使用的是 elasticsearch 6.7.2 版,但出现错误 429

{
    "error": {
        "root_cause": [
            {
                "type": "remote_transport_exception",
                "reason": "[localhost][localhost:9300][indices:data/write/bulk[s]]"
            }
        ],
        "type": "es_rejected_execution_exception",
        "reason": "rejected execution of processing of [682604930][indices:data/write/bulk[s][p]]: request: BulkShardRequest [[hboauth2-2020.04.20-000113][0]] containing [index {[hboauth2][_doc][yRuEnHEBn6z33bhuCGjZ], source[{\"Action\":\"Service UpdateUserStatus Start\",\"ClientID\":\"\",\"Code\":0,\"Component\":\"UpdateUserStatus\",\"CustomMessage\":\"\",\"Data\":\"null\",\"LogDate\":1587468830939,\"Message\":\"{OK false}\",\"Type\":\"Info\",\"UserID\":\"4c220ab2-282d-466f-a9f5-da0e59b7b803\"}]}], target allocation id: wZFZUPi5TnSYFg-BNonHug, primary term: 1 on EsThreadPoolExecutor[name = localhost/write, queue capacity = 200, org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor@744831b0[Running, pool size = 16, active threads = 16, queued tasks = 224, completed tasks = 264136589]]"
    },
    "status": 429
}

我找到了解决问题的方法,但是在我的版本中找不到参数threadpool.bulk.queue_size。你能帮我找到和改变这个参数吗

标签: elasticsearchthreadpool

解决方案


官方示例所示,您可以使用 elasticsearch.config 中的以下配置更改批量线程池的队列大小或更新集群设置。

请注意,写入线程池用于批量请求,如同一链接中所述:

write 用于单文档索引/删除/更新和批量请求。线程池类型的大小固定为可用处理器数,queue_size 为 200。此池的最大大小为 1 + 可用处理器数。

thread_pool:
    write:
        size: 30. --> no if threads in your case, its 16 as shown in exception
        queue_size: 400 --> here you can add `queue_size`

还提到了有关更改这些设置的说明

可以通过设置特定类型的参数来更改特定的线程池;例如,改变写线程池中的线程数:

编辑:正如@val 在评论部分指出的那样,添加关于更改这些默认设置的免责声明。

请了解这些设置的技术细节和影响,因为这些通常不建议更改,更多信息请参阅此官方博客


推荐阅读