问题描述
我想查看为特定主题设置的保留期.有什么命令吗?我尝试过
I want to see the retention period set for a particular topic.Is there any command? I tried with
bin/kafka-topics.sh --zookeeper hostname:2181 --alter --config retention.ms=172800000 --topic <topic_name>
用于删除2天前的数据.但是我想看看所有主题的保留期都设置了多少天.
for deleting 2 days old data. But I want to see how many days are set in the retention period for all the topics.
推荐答案
如果您更改了主题并希望查看主题配置,则以下命令将很有帮助
If you have altered a topic and want to view the topic configuration the following command will be helpful
kafka-topics.sh --zookeeper localhost:2181 --describe --topics-with-overrides
这将仅描述主题以及配置设置与集群默认设置不同的配置.
This will describe only the topics along with configurations that have configurations set that differ from the cluster defaults.
如果要查看所有主题的配置您可以在服务器中
在kafka的配置目录中. log.retention.hours
或 log.retention.ms
查看这些属性..properties
If you want to view the configurations for all topicEither you can view these properties log.retention.hours
or log.retention.ms
in server.properties
in kafka config directory.
这篇关于如何在Kafka中查看特定主题的保留的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!