解码Apache Kafka日志

时间:2018-10-27 10:52:50

标签: apache-kafka kafka-producer-api

我最近开始研究Apache Kafka。
我配置了zookeeper,还配置了Kafka实例(经纪人)。
一切都很好。
昨天我使用生产者(使用默认分区)发送了许多消息并使用了它们。此活动创建了许多日志文件夹,格式为

主题名称分区号 例如:-Ajinkya-0,Ajinkya-10,Ajinkya-12等...

今天,当我重新启动Apache Kafka时,我收到了很多日志

[2018-10-27 15:09:19,917] INFO [Log partition=__consumer_offsets-39, dir=/home/ajinkya/software/Kaftka/kafka_2.11-2.0.0/Kafka-logs] Loading producer state till offset 0 with message format version 2 (kafka.log.Log)
[2018-10-27 15:09:19,917] INFO [Log partition=__consumer_offsets-39, dir=/home/ajinkya/software/Kaftka/kafka_2.11-2.0.0/Kafka-logs] Loading producer state till offset 0 with message format version 2 (kafka.log.Log)
[2018-10-27 15:09:19,918] INFO [Log partition=__consumer_offsets-39, dir=/home/ajinkya/software/Kaftka/kafka_2.11-2.0.0/Kafka-logs] Completed load of log with 1 segments, log start offset 0 and log end offset 0 in 2 ms (kafka.log.Log)
[2018-10-27 15:09:19,919] INFO [Log partition=__consumer_offsets-21, dir=/home/ajinkya/software/Kaftka/kafka_2.11-2.0.0/Kafka-logs] Recovering unflushed segment 0 (kafka.log.Log)
[2018-10-27 15:09:19,919] INFO [Log partition=__consumer_offsets-21, dir=/home/ajinkya/software/Kaftka/kafka_2.11-2.0.0/Kafka-logs] Loading producer state till offset 0 with message format version 2 (kafka.log.Log)
[2018-10-27 15:09:19,920] INFO [Log partition=__consumer_offsets-21, dir=/home/ajinkya/software/Kaftka/kafka_2.11-2.0.0/Kafka-logs] Loading producer state till offset 0 with message format version 2 (kafka.log.Log)
[2018-10-27 15:09:19,920] INFO [Log partition=__consumer_offsets-21, dir=/home/ajinkya/software/Kaftka/kafka_2.11-2.0.0/Kafka-logs] Completed load of log with 1 segments, log start offset 0 and log end offset 0 in 1 ms (kafka.log.Log)
[2018-10-27 15:09:19,922] INFO [Log partition=Ajinkya-74, dir=/home/ajinkya/software/Kaftka/kafka_2.11-2.0.0/Kafka-logs] Recovering unflushed segment 0 (kafka.log.Log)

为什么我将日志显示为

Loading producer state till offset 0 with message format version 2 (kafka.log.Log)    
 Completed load of log with 1 segments, log start offset 0 and log end offset 0 in 1 ms (kafka.log.Log)

由于消息已被使用,为什么我仍然看到加载日志
我也看到了所有分区(即50个分区)的加载日志
由于分区的数量将增加,因此日志的数量也将增加。

1 个答案:

答案 0 :(得分:0)

请参见the kafka documentation

Kafka不像传统的消息传递中间件(JMS,RabbitMQ等)。

记录将在日志中保留7天(默认情况下)。请参见log.retention.hourslog.retention.minutes。消费者可以追溯到保留期。

我删除了标记,因为此问题与Spring完全无关。