Elasticsearch
[Elasticsearch] maximum shards open 에러
빈쿵바라기
2022. 12. 14. 23:13
Problem
기존에 운영중이던 Elasticsearch에 새로운 index를 만드려고 시도하는 중에 아래와 같이 maximum shards open 에러 로그가 출력되었습니다.
{
"type": "validation_exception",
"reason": "Validation Failed: 1: this action would add [2] total shards, but this cluster currently has [1000]/[1000] maximum shards open;"
}
현재 노드당 최대 shard 개수가 1000개인데, 1000개가 모두 열려 있는 상태에서 새로운 index를 생성하려다가 에러가 발생하였습니다.
현재 shard 확인
$ curl -s -XGET localhost:9200/_cat/shards | wc -l
1000
해결방법
클러스터의 shard 수를 줄이거나, 아래와 같이 /_cluster/settings
요청을 통해 shard의 최대 개수를 변경하여 해결할 수 있습니다.
curl -X PUT localhost:9200/_cluster/settings -H "Content-Type: application/json" -d '{ "persistent": { "cluster.max_shards_per_node": "3000" } }'
$ curl -s -XGET localhost:9200/_cat/shards | wc -l
3000