4

We have 3 kafka machines version - 0.10.0.2.6

We want to purge all data files from all kafka's topics ( purge completely all data )

The CLI for this action should be ( should be run from the zoo server )

kafka-topics.sh --zookeeper localhost:2181 --alter --topic Topic1 --config retention.ms=1000
kafka-topics.sh --zookeeper localhost:2181 --alter --topic Topic2 --config retention.ms=1000
kafka-topics.sh --zookeeper localhost:2181 --alter --topic Topic3 --config retention.ms=1000
kafka-topics.sh --zookeeper localhost:2181 --alter --topic Topic4 --config retention.ms=1000
.

. .

Since we Temporarily update the retention time on the topic to one second (1000 ms )

Then how to return the previous original retention!

Note - log.retention.hours = 168 ( from the ambari GUI ) and this is the original value

So how to return the original value (168 hours) back on all topics ? after purge all Topics?

LIST OF TOPICS

/usr/hdp/2.6.0.3-8/kafka/bin/kafka-topics.sh  --list --zookeeper localhost:2181
__consumer_offsets 
_schemas
hrtfsa.polr.mdr.initial
hrtfsa.polr.pri.content_analysis
hrtfsa.polr.pri.decoded
hrtfsa.polr.pri.enriched.suspected_relation
hrtfsa.polr.pri.id_correlation
hrtfsa.polr.pri.processed
hrtfsa.polr.suspected_relations
hrtfsa.monitoring.heartbeat

I found this ( https://gist.github.com/dmitz/47e230b35d84df900c2d57370f4e85b2 )

purge the topic:

kafka-topics --zookeeper <zookeeper_address> --alter --topic <topic_name> --config retention.ms=1000

return the orig value of retention:

kafka-topics --zookeeper <zookeeper_address> --alter --topic <topic_name> --delete-config retention.ms

Is this correct for version 0.10.0.2.6 ?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
enodmilvado
  • 443
  • 1
  • 9
  • 20

0 Answers0