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.dir
attribute 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-0
where/tmp/kafka-logs
is specified by thelog.dir
attribute - 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 " ...
随机推荐
- 监听当点击微信等app的返回按钮或者浏览器的上一页或后退按钮的事件
在实际的应用中,我们常常需要实现在移动app和浏览器中点击返回.后退.上一页等按钮实现自己的关闭页面.调整到指定页面或执行一些其它操作的 需求,那在代码中怎样监听当点击微信.支付宝.百度糯米.百度钱包 ...
- 在IDEA(phpStorm)中使用Babel编译ES6
安装Babel 官方文档建议我们根据单个项目进行本地安装,原因是不同的项目可以依赖不同版本的 Babel,使你的项目更方便移植.更易于安装. 在项目的根目录下使用命令行工具(CMD等)执行下面代码 n ...
- LeetCode152:Maximum Product Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest ...
- 在MyEclipse上安装svn插件
最近需要用到myeclipse做一个商城的项目开发,用svn作为项目的版本控制软件.但是在myeclipse上安装svn插件就是装不好,反复折腾了好几次都安装不成功.网上提供的安装办法有两种,一是:在 ...
- 在win7下安装VC6.0
一.以系统管理员的身份执行VC6.0安装文件 二.在安装或者使用VisualC++6.0时,凡是出现兼容性问题提示对话框,一律按下面方式处理--把"不再显示此消息"打上勾,然后选择 ...
- linux 查找文件命令
find -name 文件名 在当前目录下查找 find -name nginx.conf
- Vmware esx/esxi Vlan三种配置模式(VST、EST和VGT)
在Vmware esx/esxi中使用虚拟Lan(Vlan)时,一般是指Vlan Trunk的使用,使用的Vlan配置还有其它三种类型: Virtual Switch Tagging(虚拟交换机标记, ...
- python里的引用、浅拷贝、深拷贝
参考: 1.http://wsfdl.com/python/2013/08/16/%E7%90%86%E8%A7%A3Python%E7%9A%84%E6%B7%B1%E6%8B%B7%E8%B4%9 ...
- 5.synchronized锁重入
package demo1; /** * synchronized锁重入 * Created by liudan on 2017/6/5. */ public class MyThread5_sync ...
- Html5 中获取镜像图像 - 解决 WebGL 中纹理倒置问题
Html5 中获取镜像图像 - 解决 WebGL 中纹理倒置问题 太阳火神的漂亮人生 (http://blog.csdn.net/opengl_es) 本文遵循"署名-非商业用途-保持一致& ...