ELK
Elasticsearch max shards per node 설정 - maximum shards open error
Network && Devops
2024. 2. 14. 08:37
반응형
반응형
반응형
Elasticsearch 를 사용하다보면 아래와 같은 로그가 발생하며
로그 수집이 되지 않는 경우가 있다.
{
_index: 'logstash-2024.02.14',
_id: 'SgRcQ4wBSL1deYXKnJK2',
status: 400,
error: {
type: 'validation_exception',
reason: 'Validation Failed: 1: this action would add [2] shards, but this cluster currently has [999]/[1000] maximum normal shards open;'
}
}
currently has [999]/[1000] maximum normal shards open
라는 문구는 노드당 최대 shard 개수를 초과했다라는 것으로 max_shards_per_node 수를 변경해 주면 간단히 해결 할 수 있다.
Elasticsearch를 설치하면 기본값으로 노드당 샤드 갯수가 1000개 이다.
반응형
현재 max_shards_per_node 값 확인
아래 명령어로 확인할 수 있으며, 현재 max_shards_per_node 값은 1000개로 설정되어 있다.
curl -s -XGET localhost:9200/_cluster/settings?include_defaults&flat_settings
{
"persistent":{
"cluster":{
"max_shards_per_node":"1000"
}
},
...
반응형
max_shards_per_node 변경 방법
반응형
1. Linux shell
curl -s -XPUT localhost:9200/_cluster/settings -H "Content-Type: application/json" -d '{ "persistent": { "cluster.max_shards_per_node": "5000" } }'
반응형
2. kibana Dev-Tool
Kibana Dev-Tool 콘솔 접속후 실행
PUT /_cluster/settings
{
"persistent": {
"cluster.max_shards_per_node": "5000"
}
}
반응형
3.elasticsearch.yml 파일 수정
# vi elasticsearch.yml
# 기존 설정들...
# 새로운 설정 추가 또는 수정
max_shards_per_node: 5000
# 기존 설정들...
elasticsearch.yml 파일을 수정할 경우 elasticsearch 데몬을 재시작해 주어야 하기 때문에
위의 1,2번을 사용하는것을 권장.
변경 결과 확인
반응형
반응형