Elasticsearch报错Validation Failed: 1: this action would add [2] total shards, but this cluster currently has [999]/[1000] maximum shards open
1.故障现象
elasticsearch报错
Validation Failed: 1: this action would add [2] total shards, but this cluster currently has [999]/[1000] maximum shards open
2.故障原因
Elasticsearch分片不足
3.解决方法
查看现有分片数
# curl -XGET -s http://172.16.5.103:9200/_cat/shards?v|wc -l
查看默认分片数
显示为空
# curl -XGET http://172.16.5.103:9200/_cluster/settings?pretty
{
"persistent" : {
"cluster" : {
"max_shards_per_node" : ""
}
},
设置分片数
# curl -XPUT -H "Content-Type:application/json" -d '{"persistent":{"cluster":{"max_shards_per_node":10000}}}' 'http://172.16.5.104:9200/_cluster/settings'
再次查看
# curl -XGET http://172.16.5.103:9200/_cluster/settings?pretty
{
"persistent" : {
"cluster" : {
"max_shards_per_node" : "10000"
}
},
- 以上设置在重启elasticsearch后依然生效
- 删除索引也可以减少分片数
如果是应用报错则重启对应应用或pod