kafka delete topic
Don't think it is supported yet. Take a look at this JIRA tracking Delete Topic. For delete manually
- Shutdown the cluster
- Clean kafka log dir (specified by the
log.dirattribute in kafka config file ) as well the zookeeper data - Restart the cluster
For any given topic what you can do is
- Stop kafka
- Clean kafka log specific to partition, kafka stores its log file in a format of "logDir/topic-partition" so for a topic named "MyTopic" the log for partition id 0 will be stored in
/tmp/kafka-logs/MyTopic-0where/tmp/kafka-logsis specified by thelog.dirattribute - Restart kafka
This is NOT a good and recommended approach but it should work. In the Kafka broker config file the log.retention.hours.per.topic attribute is used to define The number of hours to keep a log file before deleting it for some specific topic
bin/kafka-run-class.sh kafka.admin.DeleteTopicCommand --zookeeper localhost:2181 --topic test
命令删除后数据文件依然存在,上边的方法是根本删除
create kafka-delete-topic.sh file
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
base_dir=$(dirname $0)
export KAFKA_OPTS="-Xmx512M -server -Dcom.sun.management.jmxremote -Dlog4j.configuration=file:$base_dir/kafka-console-consumer-log4j.properties"
$base_dir/kafka-run-class.sh kafka.admin.DeleteTopicCommand $@
https://issues.apache.org/jira/browse/KAFKA-330
http://stackoverflow.com/questions/17730905/is-there-a-way-to-delete-all-the-data-from-a-topic-or-delete-the-topic-before-ev
kafka delete topic 问题跟进
https://issues.apache.org/jira/browse/KAFKA-330
kafka delete topic的更多相关文章
- 【帖子】怎么彻底删除kafka的topic,然后重建?
怎么彻底删除kafka的topic,然后重建? 网上都说用kafka-run-class.shkafka.admin.DeleteTopicCommand 命令删除topic,但是并没有成功,用kaf ...
- kafka删除topic的方法及我在kafka上边的一些经验
我在本地做kafka的producer调试,每隔一段时间后,所使用的topic管道就会堆积数据,而且我这边使用的是 kafka bin 下的consumer命令单独消费的,每次都是 --fro ...
- 删除kafka的topic及kafka基本命令
kafka的topic默认是不允许被删除的,删除后在topic后会出现”marked for deletion”字样,实际并未删除,现在创建同样的topic会提示topic已经存在. 解决办法: se ...
- 如何删除Kafka的Topic
在server.properties文件中添加配置:delete.topic.enable=true 创建kafka主题: kafka-topics.sh --create --zookeeper 1 ...
- kafka删除topic详解
1.删除topic命令 bin/kafka-topics.sh --delete --zookeeper 192.168.242.131:2181 --topic aaa 注:此命令如果要生效,还需在 ...
- [Spark][kafka]kafka 的topic 创建和删除试验
kafka 的topic 创建和删除试验 zookeeper和kafka 的安装,参考: http://www.cnblogs.com/caoguo/p/5958608.html 参考上述URL后,在 ...
- 052 kafka对topic的增删改查操作
一:create 1.开始使用命令 2.创建 bin/kafka-topics.sh --create --topic beifeng --zookeeper linux-hadoop01.ibeif ...
- kafka删除topic数据
一.概述 生产环境中,有一个topic的数据量非常大.这些数据不是非常重要,需要定期清理. 要求:默认保持24小时,某些topic 需要保留2小时或者6小时 二.清除方式 主要有3个: 1. 基于时间 ...
- kafka 清除topic数据脚本
原 kafka 清除topic数据脚本 2018年07月25日 16:57:13 pete1223 阅读数:1028 #!/bin/sh param=$1 echo " ...
随机推荐
- maven 自动部署到 tomcat7
多方搜索,终于使maven项目可以自动发布到tomcat下了. tomcat7 需要使用 tomcat-maven-plugin 的新版本,版本支持tomcat6和tomcat7,groupId也由o ...
- 背景建模或前景检測之PBAS
申明,本文非笔者原创,原文转载自:http://blog.csdn.net/kcust/article/details/9931575 Pixel-Based Adaptive Segmenter(P ...
- if....else的基本用法
if....else...是基本流程控制语句 1.基本格式: if(条件){ }else if(条件){ }else if(条件){ } ........ else{ } 解释:其中else if.e ...
- mysql 5.6 与5.7安装
http://blog.itpub.net/29733787/viewspace-1590891/ http://www.oschina.net/code/snippet_7933_45700
- MYSQL 源代码学习
http://ourmysql.com/ http://blog.chinaunix.net/uid-26896862-id-4009777.html
- FIREDAC不能识别SQL的某些字段类型
FIREDAC不能识别SQL的某些字段类型 经常见有网友有类似的提问:请问各位,在DataSnap中使用SQL数据SUM函数,如果是统计浮点型数值的话,返回是乱码,哪位是什么原因? 其实这不是DAT ...
- SVN中的Trunk、Tag、Brance的用法
在SVN中Branch/tag在一个功能选项中,在使用中也往往产生混淆.在实现上,branch和tag,对于svn都是使用copy实现的,所以他们在默认的权限上和一般的目录没有区别.至于何时用tag, ...
- 《JavaScript网页特效经典300例》
<JavaScript网页特效经典300例> 基本信息 作者: 杨磊 张志美 丛书名: 百炼成钢系列丛书 出版社:电子工业出版社 ISBN:9787121220524 上架时间:20 ...
- Adhoc
没觉得Adhoc还有什么做的,这几年貌似很冷了,从通信的角度讲,实现比较困难,实际意义不大,国内最近又跟风了VANET.以我同学做的为例,他考虑用Adhoc做野外分散点的自组网(一个集体内),但从通信 ...
- DAO,Service接口与实现类设计
DAO接口 为每个DAO声明接口的好处在于 1. 可以在尚未实现具体DAO的时候编写上层代码,如Service里对DAO的调用 2. 可以为DAO进行多实现,例如有JDBCDAO实现,MyBatisD ...