Elasticsearch

Elasticsearch 세 번째 물음표

공주맛밤 2022. 5. 3. 17:53

전혀 예상치 못하게 문제가 생겼다. logstash를 conf파일을 통해 데이터를 elasticsearch로 주입하는 과정에서 데이터가 주입이 되지 않고 아래와 같은 문구만 반복적으로 나타났기 때문이다. 하지만 처음 문구를 보면 또 보안관련 문제임에 틀림없음을 알게 되었다.

Failed to perform request {:message=>"PKIX path building failed: sun.security.provider

.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target"

, :exception=>Manticore::ClientProtocolException, :cause=>javax.net.ssl.SSLHandshakeException

: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException

: unable to find valid certification path to requested target}
[WARN ][logstash.outputs.elasticsearch][main] Attempted to resurrect connection to dead ES instance, but got an error 

{:url=>"https://elastic:xxxxxx@127.0.0.1:9200/", :exception=>LogStash::Outputs::

ElasticSearch::HttpClient::Pool::HostUnreachableError, :message=>

"Elasticsearch Unreachable: [https://127.0.0.1:9200/][Manticore::ClientProtocolException] PKIX path building failed: 

sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target"}

해결방법) logstash/conf 파일에 certs라는 보안관련 파일을 하나 생성한다. 그리고 처음 elasticsearch를 실행하면 받을 수 있는 인증서를 복사하여 certs안에 넣어주고

output {
  elasticsearch {
    hosts => ["https://127.0.0.1:9200"]
    index => "practice"
    cacert => "C:/logstash-8.1.2-windows-x86_64/logstash-8.1.2/config/certs/http_ca.crt"
    user => "elastic"
    password => "password"
  }
}

과 같이 cacert로 인증서가 있는 경로를 설정해 주면 된다. 

728x90
반응형

'Elasticsearch' 카테고리의 다른 글

logstash conf설정  (0) 2022.05.03
logstash 설치  (0) 2022.05.02
Kibana 설치  (0) 2022.04.29
Elasticsearch 두번째 물음표  (0) 2022.04.29
Elasticsearch 첫번째 물음표  (0) 2022.04.29