Skip to content

Commit

Permalink
kafka删除topic
Browse files Browse the repository at this point in the history
  • Loading branch information
ppabc committed Jun 15, 2016
1 parent 0c86918 commit df6ad11
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions kafka/Kafka.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,21 @@ bin/kafka-topics.sh --create --zookeeper 192.168.142.136:2181/kafka --replicati

##列出所有主题
bin/kafka-topics.sh --list --zookeeper 192.168.142.136:2181/kafka
bin/kafka-topics.sh --describe --zookeeper 192.168.142.136:2181/kafka --topic mykafka

##在一个终端,启动Producer,执行如下命令:
bin/kafka-console-producer.sh --broker-list 192.168.142.136:9092 --topic mykafka

##在另一个终端,启动Consumer,执行如下命令:
bin/kafka-console-consumer.sh --zookeeper 192.168.142.136:2181/kafka --topic mykafka --from-beginning

##删除topic
cd /opt/kafka_2.10-0.9.0.1
bin/kafka-topics.sh --delete --zookeeper 192.168.142.136:2181/kafka --topic mykafka
##执行后,该topic会被kafka标记为删除,还需要在zookeeper中手动删除相关的节点:
[zk: localhost:2181(CONNECTED) 5] rmr /brokers/topics/mykafka


#######confluent启动
cd /opt/confluent-2.0.1/
bin/schema-registry-start etc/schema-registry/schema-registry.properties >/dev/null 2>&1 &
Expand All @@ -108,3 +116,5 @@ bin/kafka-rest-start etc/kafka-rest/kafka-rest.properties >/dev/null 2>&1 &
##停止命令
##ps ax | grep -i 'kafka-rest' | grep -v grep | awk '{print $1}' | xargs kill



0 comments on commit df6ad11

Please sign in to comment.