druid kafka index service still waiting for hand off segments

    在向overlord提交kafka index service task之后,数据可实时接收,并且在druid segments中的目录下segments已生成落盘,并且coordinator已向metastore中注册segments信息,而在task 日志中,出现以下错误。

   此时错误为:still waiting for hand off segments, 此错误会造成middlemanage 生成的task 迟迟不能完成释放,并且此时由于task未释放,druid中持续创建task, 直到task任务数达到capicity 数量,当达到capicity 数量就是无法实时从kafka读取数据,生成segments了。

   此时coordinator 日志报错如下;

   ERROR:为unable to find matching rules。要理解此错误,需对druid 从kafka ingest到 history 节点的查询过程要有理解,具体可参照文章。

   hand off 阶段

    本阶段主要由CoordinatorNodes负责,CoordinatorNodes会将已完成的Segment信息注册到元信息库、上传DeepStorage,并通知集群内HistoricalNode去加载该Segment,同时每隔一定时间间隔(默认1分钟)检查Handoff状态,如果成功,Real-TimeNode会在Zookeeper中申明已不服务该Segment,并执行下一个时间窗口内的索引任务;如果失败,CoordinatorNodes会进行反复尝试。

   总结来讲,kafka index service任务实时从kafka读取,生成segments之后,coordinator通知metastore注册segments信息,并通知history节点进行hand off,将segments复制到history节点的segmentcache目录下,只有segments hand off只history节点下,才能提供数据的查询,但并不是全部的segments都进行hand off ,在hand off 的过程中,coordiante 会检查druid 的load 和drop的segments ,只有符合规则的segments才会hand off 只history节点下。

  注意: druid提供了默认的规则,此规则务必不要删除,删除全部规则,就会报 unable to find matching rules error,无法hand off segments。

[{"tieredReplicants":{"_default_tier":1},"type":"loadForever"}]

 到添加到添加默认规则或者其他规则之后,规则可以添加至全局或者针对某个datasouce ,通过查看coordinator控制台页面,可看到rule .

coordinator和history 节点日志如下:

coordinator log:

history log:

上述日志显示,match load rules之后,coordinator向peon中的loadqueue添加handoff segments,history读取loadquuee ,load segments,完成hand offf过程。

至此解决上述问题,关于druid  相关原理文章可参考:

(1)Druid.io系列(四):索引过程分析

(2)Druid中Segements保留和自动删除规则配置

猜你喜欢

转载自blog.csdn.net/xiaobai51509660/article/details/81484329