我用的是伪造的wurstmeister/kafka-docker。我创建了一个主题
bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 27 --topic raw-sensor-data --config retention.ms=86400000几天后,我试着把保留期改为
bin/kafka-configs.sh --bootstrap-server localhost:9092 --alter --entity-type topics --entity-name raw-sensor-data --add-config retention.ms=3600000我也试过
bin/kafka-topics.sh --zookeeper locahost:2181 --alter --topic raw-sensor-data --config retention.ms=3600000和
./bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic raw-sensor-data --config cleanup.policy=delete这也反映在主题描述详细信息中。
bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topics-with-overrides
Topic: raw-sensor-data PartitionCount: 27 ReplicationFactor: 1 Configs: cleanup.policy=delete,retention.ms=3600000但我仍然可以看到旧的数据和数据没有被删除1小时的时间。
在server.properties我有
log.retention.check.interval.ms=300000
发布于 2022-06-27 16:18:14
只有关闭的日志段才会被删除。默认段大小为1GB。
因此,如果主题中的数据较少,则它将保持不变,而不管时间过去了。
https://stackoverflow.com/questions/72771770
复制相似问题