Centos7下prometheus监控kafka的插件kafka_exporter启动报错

问题:

prometheus监控kafka的插件kafka_exporter启动日志报错如下
time="2020-12-11T08:41:08+08:00" level=error msg="Cannot get leader of topic input_topic partition 1: kafka server: In the middle of a leadership election, there is currently no leader for this partition and hence it is unavailable for writes." source="kafka_exporter.go:275"
time="2020-12-11T08:41:08+08:00" level=error msg="Cannot get leader of topic input_topic partition 1: kafka server: In the middle of a leadership election, there is currently no leader for this partition and hence it is unavailable for writes." source="kafka_exporter.go:275"
time="2020-12-11T08:41:08+08:00" level=error msg="Cannot get leader of topic input_topic partition 1: kafka server: In the middle of a leadership election, there is currently no leader for this partition and hence it is unavailable for writes." source="kafka_exporter.go:275"
time="2020-12-11T08:41:08+08:00" level=error msg="Cannot get leader of topic input_topic partition 1: kafka server: In the middle of a leadership election, there is currently no leader for this partition and hence it is unavailable for writes." source="kafka_exporter.go:275"


time="2020-12-11T08:42:07+08:00" level=error msg="Cannot get oldest offset of topic tb.transport.api.responses partition 1: kafka: broker not connected" source="kafka_exporter.go:296"
time="2020-12-11T08:42:07+08:00" level=error msg="Cannot get oldest offset of topic message_queue_output_dic partition 0: kafka: broker not connected" source="kafka_exporter.go:296"
time="2020-12-11T08:42:37+08:00" level=error msg="Cannot get oldest offset of topic message_queue_output_dic partition 1: kafka: broker not connected" source="kafka_exporter.go:296"

 

解决方法:

前提是kafka的配置文件 server.properties 必须配置如下参数:

# 启用删除主题
delete.topic.enable=true
# 检查日志段文件的间隔时间,以确定是否文件属性是否到达删除要求。
log.retention.check.interval.ms=1000

需要把如上报错的topic删除后重建即可完成:input_topic,message_queue_output_dic
将这两个topic删除后重建解决问题
1、查看topic信息
./kafka-topics.sh --describe --zookeeper 192.168.5.53:2181 --topic input_topic
Topic:input_topic       PartitionCount:3        ReplicationFactor:1     Configs:
        Topic: input_topic      Partition: 0    Leader: 1       Replicas: 1     Isr: 1
        Topic: input_topic      Partition: 1    Leader: -1      Replicas: 2     Isr: 1
        Topic: input_topic      Partition: 2    Leader: 3       Replicas: 3     Isr: 3
2、删除topic
./kafka-topics.sh --delete --zookeeper 192.168.5.53:2181 --topic input_topic partition
3、重建topic问题报错解决
./kafka-topics.sh --create --zookeeper 192.168.5.53:2181 --topic input_topic partition --replication-factor 3 --partitions 3

topic:message_queue_output_dic 按照1-3步骤完成操作即可。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

划水的运维

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值