by default all topics in our kafka cluster are with retention hours=24
, ( as defined in kafka server.properties )
we decided to decrease the retention hours only on topic test
to 64000
ms
so we set the following retention hours - 64000
on topic test
kafka-configs.sh --zookeeper zoo_server:2181 --entity-type topics --alter --entity-name test -add-config retention.ms=64000
now we want to return the default retention hours on topic test ( to 24
hours ) ,as was before
we don’t sure if the following kafka cli , really return the retention hours to 24
on topic test
kafka-configs.sh --zookeeper zoo_server:2181 --alter --entity-type topics --entity-name test --delete-config retention.ms
as I know the above delete the configuration of the retention in ms
but I not sure if this is really what above command is doing
please advice if I am wrong?
NOTE: in order to get all data about retention for particular topic in kafka , we can do
kafka-topics.sh --zookeeper zoo_server:2181 --describe --topics-with-overrides
reference- How to see the retention for a particular topic in kafka - Stack Overflow
reference - apache kafka - Delete topic level config - Stack Overflow
additionally:
I can suggest other approach as:
kafka-configs.sh --zookeeper zoo_server:2181 --entity-type topics --alter --entity-name test -add-config retention.ms=86400000
its configure the 24 hours for test topic , but this is workaround
but I preferred is to delete the configuration of retention in ms instead of set the retention in ms to 86400000