Altering TTL for a particular topic in Kafka

2019-08-12 18:51发布

Update TTL for a topic so records stay in the topic for 10 days. Do this for this topic only. Leave all other topics TTL's the same, current configuration

1条回答
我命由我不由天
2楼-- · 2019-08-12 19:24

you have already asked about that and I have already replied here : Update TTL for a particular topic in kafka using Java

or maybe are you asking to do that not in Java but just using Kafka tools ? In this case there is the kafka-topics.sh command line tool for doing that using the --alter option.

bin/kafka-topics.sh --alter --zookeeper localhost:2181 --topic test --config retention.ms=10000

Because altering using kafka-topics script could be removed in next release, you should use the kafka-configs script :

bin/kafka-configs.sh --zookeeper localhost:2181 --alter --entity-type topics --entity-name test --add-config retention.ms=5000
查看更多
登录 后发表回答