首页 > 其他分享 >记一次Elasticsearch GeoIpDownloader的启动异常排查过程

记一次Elasticsearch GeoIpDownloader的启动异常排查过程

时间:2023-03-13 22:39:08浏览次数:37  
标签:GeoIpDownloader geoip databases 排查 Elasticsearch 分片 node1 elasticsearch

公众号:MCNU云原生,文章首发地,欢迎微信搜索关注,更多干货,第一时间掌握!

最近碰到了Elasticsearch GeoIpDownloader相关的一个异常,花费了不少精力排查,故此记录一下,希望碰到同样问题的童鞋们少走弯路。

这个异常是在Elasticsearch启动的过程中报的error,如下所示,从提示信息来看是因为GeoIpDownloader更新数据库失败导致。

[2023-02-01T15:34:09,249][ERROR][o.e.i.g.GeoIpDownloader  ] [node1] exception during geoip databases updateorg.elasticsearch.ElasticsearchException: not all primary shards of [.geoip_databases] index are active at [email protected]/org.elasticsearch.ingest.geoip.GeoIpDownloader.updateDatabases(GeoIpDownloader.java:134)
...
[2023-02-01T15:34:10,144][WARN ][o.e.i.g.GeoIpDownloader  ] [node1] could not delete old chunks for geoip database [GeoLite2-ASN.mmdb]org.elasticsearch.action.search.SearchPhaseExecutionException: all shards failed at [email protected]/org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseFailure(AbstractSearchAsyncAction.java:728)

GeoIpDownloader是用于下载地图数据库的,在更新的过程中会判断是否所有的分片都是active状态,如果不是的话会抛出这个错误。

        var geoipIndex = clusterState.getMetadata().getIndicesLookup().get(GeoIpDownloader.DATABASES_INDEX);
        if (geoipIndex != null) {
            if (clusterState.getRoutingTable().index(geoipIndex.getWriteIndex()).allPrimaryShardsActive() == false) {
                throw new RuntimeException("not all primary shards of [" + DATABASES_INDEX + "] index are active");

实际上在第一次启动Elasticsearch的时候运行是正常的,并没有出现这个错误,从日志来看,确实Elasticsearch自动创建了一个名为.geoip_databases的索引,并且自动下载了geoip数据库,名为GeoLite2-ASN.mmdb,当重新启动以后程序会自动去更新这个数据库。

[2022-12-14T14:30:42,065][INFO ][o.e.c.m.MetadataCreateIndexService] [node1] [.geoip_databases] creating index, cause [auto(bulk api)], templates [], shards [1]/[0]
[2022-12-14T14:30:42,463][INFO ][o.e.c.r.a.AllocationService] [node1] current.health="GREEN" message="Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.geoip_databases][0]]])." previous.health="YELLOW" reason="shards started [[.geoip_databases][0]]"
[2022-12-14T14:30:43,929][INFO ][o.e.i.g.GeoIpDownloader  ] [node1] successfully downloaded geoip database [GeoLite2-ASN.mmdb]
[2022-12-14T14:30:44,355][INFO ][o.e.i.g.DatabaseNodeService] [node1] successfully loaded geoip database file [GeoLite2-ASN.mmdb]

既然提示说存在分片的状态是非active的,那么就使用_cat API查询一下.geoip_databases索引的分片情况。

https://192.168.56.11:9200/_cat/shards/.geoip_databases?v
index            shard prirep state   docs  store ip            node
.geoip_databases 0     p      STARTED   37 35.6mb 192.168.56.11 node1

可以看到是有一个编号是0的分片,是一个主分片,状态是STARTED,再通过索引级别的cat API看看结果,通过以下结果可以看到这个索引有1个主分片,0个副本分片,整体状态是green的。

https://192.168.56.11:9200/_cat/indices/.geoip_databases?v
health status index            uuid                   pri rep docs.count docs.deleted store.size pri.store.size
green  open   .geoip_databases CFuIkBC2QFSKf4a8aiKmcA   1   0         37            0     35.6mb         35.6mb

这基本可以判定.geoip_databases并没有存在非active状态的分片。这里似乎存在一个状态判断异常的问题。

我在社区留言,官方团队回复:

一、排查是否可能是因为资源不足,例如存储不足;

二、在GeoIpDownloader中有几个已知的竞争条件,在启动/停止的时候可能触发一些意向不想的问题,这些问题目前对集群的运行没有影响,只是在启动的时候短暂出现。github上有issue专门在讨论这个问题:https://github.com/elastic/elasticsearch/issues/92888。

初步判断在GeoIpDownloader下载更新的环节存在bug,可能导致索引分片状态判断不准确,从而抛出以上错误。

解决方案:

可以在未使用到此功能的时候选择先关闭geoip库的更新,在elasticsearch.yml中添加如下配置:

ingest.geoip.downloader.enabled: false

关闭geoip数据库的更新,重新启动后会自动删除.geoip_databases索引。

本文由博客一文多发平台 [OpenWrite]发布!

标签:GeoIpDownloader,geoip,databases,排查,Elasticsearch,分片,node1,elasticsearch
From: https://blog.51cto.com/u_15954040/6114609

相关文章

  • gnome-shell 内存占用过高问题排查处理
    查看内存占用TOP10psaux|head-1;psaux|grep-vPID|sort-rn-k+4|head-10查看gnome-shell内存使用情况psauxwww|grepgnome-shell临时解决gnome-shel......
  • CH582 CH592 CH573 PC指针打印(排查程序运行+死循环指示)
    代码调试如果需要程序死循环,又不晓得停在哪,可以通过打印PC指针进行定位,具体方法如下比如开启看门狗中断,开发方法参考CH573CH582CH579看门狗使用-debugdabiaoge-博......
  • Trino Master OOM 排查记录
    背景最近线上的trino集群master节点老是因为OOMcrash,我们注意到trinocrash前集群正在运行的查询数量正常,不太像是因为并发查询数据太多导致的OOM。遂配置trino......
  • Java运行程序占用CPU100%故障排查
          通过进程查线程,查看线程是否正常                 ......
  • mysql数据库的MDL锁排查
    数据准备:  开启一个事务:   ......
  • ES008-Elasticsearch+hbase整合
    1:设计索引库的settings信息的mappings信息,并把这些配置信息保存到一个配置文件中。1.1viarticles.json{"settings":{"number_of_shards":3,"nu......
  • ES007-Elasticsearch中文分词集成
    1、elasticsearch官方只提供smartcn这个中文分词插件,效果不是很好2、引入分词器前命令行下测试curl'http://localhost:9200/jf/_analyze?pretty=true'-d'{......
  • 容器内微服务OOM问题排查及解决
    背景问题现象:测试环境,有一个功能的所有接口请求超时,查看微服务下的日志,发现OOM了问题环境:Kubernetes环境,微服务部署在pod的容器中 问题排查1、环境出现问题时,首先查......
  • SpringBoot整合ElasticSearch
    ElasticSearch是个开源分布式搜索引擎,提供搜集、分析、存储数据三大功能。它的特点有:分布式,零配置,自动发现,索引自动分片,索引副本机制,restful风格接口,多数据源,自动搜索负载......
  • cpu、内存问题排查——gperftools 性能测试工具介绍
      在阅读reids源码时发现redis在自身内存管理malloc/frees的时候使用到tcmalloc,google后发现此组件竟然出自google开源的gperftools性能分析工具集,然后发现许多大虾云......