kafka+如何使用kafka-cli将主题保留时间更改为kafka-configs



我们想将kafka保留小时数更改为1小时

kafka-configs.sh --alter --zookeeper localhost:2181  --entity-type topics  --entity-name topic_test --add-config retention.hours=1
Error while executing config command Unknown topic config name: retention.hours
org.apache.kafka.common.errors.InvalidConfigurationException: Unknown topic config name: retention.hours

然后我们试试

kafka-configs.sh --alter --zookeeper localhost:2181  --entity-type topics  --entity-name topic_test --add-config retention.ms=3600000
Completed Updating config for entity: topic 'test_topic'.

我的方程式是

剂量retention.msretention.hours相同,但以毫秒为单位?

目标是在 1小时后清除数据Kafka文件

但是kafka-configs.sh不接受retention.hours=1,所以我们将其更改为retention.ms=3600000

据我所知保留时间由集群范围控制,如:

log.retention.ms
log.retention.minutes
log.retention.hours  

因此此配置属性从高到低但正如我所解释的,kafka cli不能使用retention.hours,所以这就是我使用retention.ms=3600000的原因

参考-

https://jaceklaskowski.gitbooks.io/apache-kafka/content/kafka-log-cleanup-policies.html#log-保留https://docs.cloudera.com/HDPDocuments/HDP3/HDP-3.1.5/installing-configuring-kafka/content/log_settings.html

retention.hours不作为主题配置存在

最新更新