首页 > 解决方案 > 增加弹性搜索 Kubernetes 中的分片数

问题描述

部署了一个Elasticsearchon GKE。ECK 有 3 个主节点和 2 个数据节点。当创建具有 1 个分片和 1 个副本的索引时,当分片数达到 1000 时收到 400 错误响应。

是否可以增加分片数?请提出一种增加分片数量的方法。

错误详情

Invalid NEST response built from a unsuccessful (400) low level call on PUT: /t-2af14520-e76d-4091-a51d-1c89cf990e97
Audit trail of this API call:
[1] BadResponse: Node: http://eck.com/ Took: 00:00:00.2833118
OriginalException: Elasticsearch.Net.ElasticsearchClientException: Request failed to execute. Call: Status code 400 from: PUT /t-2af14520-e76d-4091-a51d-1c89cf990e97. ServerError: Type: illegal_argument_exception Reason: "Validation Failed: 1: this action would add [2] total shards, but this cluster currently has [2000]/[2000] maximum shards open;"
Request:
<Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
Response:
<Response stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>

标签: elasticsearchkubernetesgoogle-kubernetes-engine

解决方案


您可以按如下方式更改分片编号。有关更多详细信息,请参阅集群更新设置 API。我建议您在测试后应用它。

PUT /_cluster/settings
{
    "persistent" : {
        "cluster.max_shards_per_node" : 3000
    }
}

推荐阅读