본문 바로가기

Troubleshooting

Elasticsearch에서 GeoIP 업데이트 오류 해결하기

반응형

서론

Elasticsearch를 운영하다 보면 다양한 이슈에 부딪힐 수 있습니다. 특히 GeoIP 기능을 사용하면서 'not all primary shards of [.geoip_databases] index are active'라는 에러 메시지를 마주친 적이 있다면, 이 글이 도움이 될 것입니다.

 

에러 로그

{"@timestamp":"2023-09-07T01:46:38.258Z", "log.level":"ERROR", "message":"exception during geoip databases update", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[elasticsearch-master-0][generic][T#1]","log.logger":"org.elasticsearch.ingest.geoip.GeoIpDownloader","elasticsearch.cluster.uuid":"GMQFhSC4QJOr_FX2U7-hvg","elasticsearch.node.id":"9eO8PArCR3KOxmVOPLqupQ","elasticsearch.node.name":"elasticsearch-master-0","elasticsearch.cluster.name":"elasticsearch","error.type":"org.elasticsearch.ElasticsearchException","error.message":"not all primary shards of [.geoip_databases] index are active","error.stack_trace":"org.elasticsearch.ElasticsearchException: not all primary shards of [.geoip_databases] index are active\n\tat org.elasticsearch.ingest.geoip@8.5.1/org.elasticsearch.ingest.geoip.GeoIpDownloader.updateDatabases(GeoIpDownloader.java:134)\n\tat org.elasticsearch.ingest.geoip@8.5.1/org.elasticsearch.ingest.geoip.GeoIpDownloader.runDownloader(GeoIpDownloader.java:274)\n\tat org.elasticsearch.ingest.geoip@8.5.1/org.elasticsearch.ingest.geoip.GeoIpDownloaderTaskExecutor.nodeOperation(GeoIpDownloaderTaskExecutor.java:102)\n\tat org.elasticsearch.ingest.geoip@8.5.1/org.elasticsearch.ingest.geoip.GeoIpDownloaderTaskExecutor.nodeOperation(GeoIpDownloaderTaskExecutor.java:48)\n\tat org.elasticsearch.server@8.5.1/org.elasticsearch.persistent.NodePersistentTasksExecutor$1.doRun(NodePersistentTasksExecutor.java:42)\n\tat org.elasticsearch.server@8.5.1/org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:892)\n\tat org.elasticsearch.server@8.5.1/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)\n\tat java.base/java.lang.Thread.run(Thread.java:1589)\n"}

 

GeoIP 오류의 원인

Elasticsearch의 GeoIP 기능은 외부에서 지리 정보 데이터베이스를 다운로드합니다. 이 데이터베이스를 업데이트하려 할 때, 모든 프라이머리 샤드가 활성화되지 않았다면 위와 같은 오류 메시지가 발생합니다.

 

해결 방법

ingest.geoip.downloader.enabled 설정 변경

이 문제를 해결하거나 일시적으로 완화시키기 위해 ingest.geoip.downloader.enabled 설정을 false로 변경할 수 있습니다. 이렇게 하면 Elasticsearch가 GeoIP 데이터베이스를 업데이트하지 않게 됩니다.

이 설정을 변경하는 이유

안정성 향상: GeoIP 업데이트 중 문제가 발생해도 Elasticsearch 클러스터가 안정적으로 운영됩니다.
트러블 슈팅 용이성: 설정을 변경하면 다른 가능한 원인을 더 쉽게 찾을 수 있습니다.
리소스 절약: 네트워크 및 스토리지 리소스를 절약할 수 있습니다.
디버깅 용이성: 오류 로그가 줄어들어 디버깅이 더 쉬워집니다.

 

결론

GeoIP 오류는 많은 Elasticsearch 사용자가 겪는 고민 중 하나입니다. ingest.geoip.downloader.enabled 설정을 false로 변경함으로써 이 문제를 일시적으로 해결하거나 완화시킬 수 있습니다. 하지만 이는 임시 방편일 수 있으므로, 추가적인 디버깅과 모니터링이 필요합니다.

 

반응형