对所有topic起作用
log.retention.hours=72
log.cleanup.policy=delete
对指定topic起作用
./kafka-config.sh --zookeeper localhost:2181 --alter --entity-name mytopic --entity_type topics --add-config retention.ms=86400000
手动删除指定topic的过期数据
./kafka-topic.sh --zookeeper localhost:2181 --alter --topic mytopic --config cleanup.policy=delete
查看topic配置
./kafka-config --zookeeper localhsot:2181 --describle --entity-name mytopic --entity_type topics