代码之家  ›  专栏  ›  技术社区  ›  uh_big_mike_boi

设置retention.ms时Kafka无法删除数据

  •  1
  • uh_big_mike_boi  · 技术社区  · 8 年前

    所以当我寻找一种方法来计算一个主题中的消息时,这个方法是很好的

    kafka-run-class kafka.tools.GetOffsetShell --broker-list broker1:9092,broker2:9092,broker3:9092 --topic rev-dly-upd --time -1

    唯一的事情是,当我改变 retention.ms 配置到 retention.ms=1000 ,甚至检查主题是否已通过运行 kafka-topics --describe --zookeeper zookeeper1:2181 --topic rev-dly-upd . 我可以清楚地看到配置设置为1000…

    Topic:rev-dly-upd   PartitionCount:8    ReplicationFactor:3 Configs:retention.ms=1000
        Topic: rev-dly-upd  Partition: 0    Leader: 159 Replicas: 159,96,160    Isr: 159,96,160
        Topic: rev-dly-upd  Partition: 1    Leader: 160 Replicas: 160,159,94    Isr: 94,160,159
        Topic: rev-dly-upd  Partition: 2    Leader: 94  Replicas: 94,160,95 Isr: 95,94,160
        Topic: rev-dly-upd  Partition: 3    Leader: 95  Replicas: 95,94,96  Isr: 95,96,94
        Topic: rev-dly-upd  Partition: 4    Leader: 96  Replicas: 96,95,159 Isr: 95,96,159
        Topic: rev-dly-upd  Partition: 5    Leader: 159 Replicas: 159,160,94    Isr: 159,94,160
        Topic: rev-dly-upd  Partition: 6    Leader: 160 Replicas: 160,94,95 Isr: 94,160,95
        Topic: rev-dly-upd  Partition: 7    Leader: 94  Replicas: 94,95,96  Isr: 95,96,94
    

    然而当我奔跑 kafka运行类kafka.tools.getoffsetshell--代理列表broker1:9092、broker2:9092、broker3:9092--主题rev dly upd--时间-1 所有的记录都会被退回。原因可能是什么?

    1 回复  |  直到 7 年前
        1
  •  0
  •   uh_big_mike_boi    7 年前

    kafka-run-class kafka.tools.GetOffsetShell wc -l

    推荐文章