你若想真正删除它,可以如下操作:
(1)登录zookeeper客户端:命令:./bin/zookeeper-client

(2)找到topic所在的目录:ls /brokers/topics

(3)找到要删除的topic,执行命令:rmr /brokers/topics/【topic name】即可,此时topic被彻底删除
1.[root@i-3rxom299 2.4.0.0-169]# cd zookeeper/
[root@i-3rxom299 zookeeper]# ls
bin conf doc etc lib man zookeeper-3.4.6.2.4.0.0-169.jar zookeeper.jar
[root@i-3rxom299 zookeeper]# ./bin/zookeeper-client
Connecting to localhost:2181
2017-01-03 13:49:09,737 - INFO [main:Environment@100] - Client environment:zookeeper.version=3.4.6-169--1, built on 02/10/2016 05:49 GMT
2017-01-03 13:49:09,741 - INFO [main:Environment@100] - Client environment:host.name=i-3rxom299
2017-01-03 13:49:09,741 - INFO [main:Environment@100] - Client environment:java.version=1.7.0_79
2017-01-03 13:49:09,744 - INFO [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2017-01-03 13:49:09,744 - INFO [main:Environment@100] - Client environment:java.home=/usr/local/jdk1.7.0_79/jre
2017-01-03 13:49:09,744 - INFO [main:Environment@100] - Client environment:java.class.path=/usr/hdp/2.4.0.0-169//zookeeper/bin/../build/classes:/usr/hdp/2.4.0.0-169//zookeeper/bin/../build/lib/*.jar:/usr/hdp/2.4.0.0-169//zookeeper/bin/../lib/xercesMinimal-1.9.6.2.jar:/usr/hdp/2.4.0.0-169//zookeeper/bin/../lib/wagon-provider-api-2.4.jar:/usr/hdp/2.4.0.0-169//zookeeper/bin/../lib/wagon-http-shared4-2.4.jar:/usr/

2.[zk: localhost:2181(CONNECTED) 0] ls /brokers/topics
[apply, car_events9, car_events6, applysum, car_events5, wordcount, ambari_kafka_service_check, pageJsonTest, car_events2, app, car_event6, __consumer_offsets, apply_s, car_events, theme, apply_sum1, app10, apply_sum2, app11, app12, topic2, apply_sum4, app13, topic1, app14, app15, topic3, applysum2, applysum1, app2, app1, app4, apply_sum, app3, app6, app5, app8, app7, app9]

3.删除命令
[zk: localhost:2181(CONNECTED) 5] rmr /brokers/topics/app1 [zk: localhost:2181(CONNECTED) 6] rmr /brokers/topics/app2
[zk: localhost:2181(CONNECTED) 7] rmr /brokers/topics/app3
[zk: localhost:2181(CONNECTED) 8] rmr /brokers/topics/app4
[zk: localhost:2181(CONNECTED) 9] rmr /brokers/topics/app5
[zk: localhost:2181(CONNECTED) 10] rmr /brokers/topics/app6
[zk: localhost:2181(CONNECTED) 11] rmr /brokers/topics/app7
[zk: localhost:2181(CONNECTED) 12] rmr /brokers/topics/app8

Logo

Kafka开源项目指南提供详尽教程,助开发者掌握其架构、配置和使用,实现高效数据流管理和实时处理。它高性能、可扩展,适合日志收集和实时数据处理,通过持久化保障数据安全,是企业大数据生态系统的核心。

更多推荐