如何在 kafka 中查看特定主题的保留率 [英] How to see the retention for a particular topic in kafka

查看:33
本文介绍了如何在 kafka 中查看特定主题的保留率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想查看为特定主题设置的保留期限.有什么命令吗?我试过

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.

如果你想查看所有主题的配置您可以在 server 中查看这些属性 log.retention.hourslog.retention.ms.properties 在 kafka 配置目录中.

If you want to view the configurations for all topic Either you can view these properties log.retention.hours or log.retention.ms in server.properties in kafka config directory.

这篇关于如何在 kafka 中查看特定主题的保留率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆