文章目录
- 问题现象
- 错误详情
- 问题解决
问题现象
创建新的es索引报错,报错信息上说,es已经超过最大的分片数。
错误详情
关键错误信息:but this cluster currently has [999]/[1000] maximum shards open;
详细错误信息:
Caused by: org.elasticsearch.client.ResponseException: method [PUT], host [http://10.58.14.34:9200], URI [/janusgraph_idx_customer_cust_num], status line [HTTP/1.1 400 Bad Request]
{
"error": {
"root_cause": [
{
"type": "validation_exception",
"reason": "Validation Failed: 1: this action would add [2] total shards, but this cluster currently has [999]/[1000] maximum shards open;"
}
],
"type": "validation_exception",
"reason": "Validation Failed: 1: this action would add [2] total shards, but this cluster currently has [999]/[1000] maximum shards open;"
},
"status": 400
}
问题解决
更改es的最大分片数配置:文章来源:https://uudwc.com/A/jA83e
curl -X PUT "localhost:9200/_cluster/settings?pretty" -H 'Content-Type: application/json' -d '
{
"persistent" : {
"cluster" : {
"max_shards_per_node" : "5000"
}
}
}'
需要注意的是,我们这里是在 persistent 节点中设置的参数。ES 集群的 setting 配置中包含两种类型:
persistent:永久生效的配置项
transient:临时生效的配置项,集群重启就会失效文章来源地址https://uudwc.com/A/jA83e