티스토리 뷰

logstash에서 elasticsearch로 index 시에 아래와 같은 에러가 발생 되었다.

[2020-07-28T15:01:08,012][WARN ][logstash.outputs.elasticsearch] Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"spring-logback-2020.07.28", :_type=>"_doc", :routing=>nil}, #<LogStash::Event:0x686a528>], :response=>{"index"=>{"_index"=>"spring-logback-2020.07.28", "_type"=>"_doc", "_id"=>nil, "status"=>400, "error"=>{"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개 인데( cluster.max_shards_per_node ), 1000개가 모두 열려 있어 에러가 발생하였다.

$ curl -XGET {{elastic_host}}:9200/_cluster/settings?include_defaults&flat_settings
{
    "persistent": {
        "indices.breaker.request.limit": "70%",
        "xpack.monitoring.collection.enabled": "true"
    },
    "transient": {},
    "defaults": {
        "action.auto_create_index": "true",
        "action.destructive_requires_name": "false",
        "action.search.shard_count.limit": "9223372036854775807",
        "bootstrap.ctrlhandler": "true",
        "bootstrap.memory_lock": "false",
        "bootstrap.system_call_filter": "true",
        "cache.recycler.page.limit.heap": "10%",
        "cluster.follower_lag.timeout": "90000ms",
        "cluster.indices.close.enable": "true",
        "cluster.indices.tombstones.size": "500",
        "cluster.info.update.interval": "30s",
        "cluster.info.update.timeout": "15s",
        "cluster.initial_master_nodes": [
            "node-1"
        ],
        "cluster.join.timeout": "60000ms",
        "cluster.max_shards_per_node": "1000",
        
        .....
    }
}

위에 로그를 보면, event 인덱스를 하는데 2개의 shard가 필요하다고 한다.

실제 elasticsearch의 shard를 카운트 해보면, 1000으로 나온다.

$ curl -s -XGET localhost:9200/_cat/shards | wc -l
1000

그래서 일단 노드당 shard 개수를 최대 5000개로 설정 변경을 해두었다.

curl -XGET {{elastic_host}}:9200/_cluster/settings

그러면, elasticsearch에 event가 정상 인덱스 되기 시작하고, shard 개수도 1010개로 늘어나있다.

$ curl -s -XGET localhost:9200/_cat/shards | wc -l
1010

 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함