Apache kafka 删除主题级配置
为了删除一个主题中的所有数据,我将其retention.ms config设置为1000Apache kafka 删除主题级配置,apache-kafka,Apache Kafka,为了删除一个主题中的所有数据,我将其retention.ms config设置为1000 ./bin/kafka-topics.sh --zookeeper $KAFKAZKHOSTS --alter --topic <topic> --config retention.ms=1000 /bin/kafka-topics.sh--zookeeper$KAFKAZKHOSTS--alter--topic--config retention.ms=1000 这很有效。经过很短的等待,
./bin/kafka-topics.sh --zookeeper $KAFKAZKHOSTS --alter --topic <topic> --config retention.ms=1000
/bin/kafka-topics.sh--zookeeper$KAFKAZKHOSTS--alter--topic--config retention.ms=1000
这很有效。经过很短的等待,所有数据都被删除了
在更改配置之前,未在主题上设置retention.ms,因此服务器默认属性log.retention.hours=168是以前的保留策略。(服务器属性中未设置log.retention.minutes和log.retention.ms)
现在,我想从本主题中完全删除retention.ms配置,并返回到使用服务器级配置
命令如
./bin/kafka-topics.sh --zookeeper $KAFKAZKHOSTS --alter --topic <topic> --config retention.ms=
/bin/kafka-topics.sh--zookeeper$KAFKAZKHOSTS--alter--topic--config retention.ms=
或
/bin/kafka-topics.sh--zookeeper$KAFKAZKHOSTS--alter--topic--config retention.ms=null
抛出一个错误
我知道kafka-topics.sh的delete选项实际上会删除整个主题,所以我不打算尝试使用它
问题:如何完全删除主题级配置,使主题恢复为使用服务器默认设置?要删除主题配置覆盖,可以使用
kafka config
工具。例如:
./bin/kafka-configs.sh --zookeeper <zookeeper> --alter \
--entity-type topics --entity-name <topic> --delete-config retention.ms
/bin/kafka-configs.sh--zookeeper--alter\
--实体类型主题--实体名称--删除配置保留.ms
我使用的另一个传统解决方案是手动删除特定主题的特定文件夹
./bin/kafka-configs.sh --zookeeper <zookeeper> --alter \
--entity-type topics --entity-name <topic> --delete-config retention.ms