In producer mode ( -P ), kafkacat reads messages from stdin, delimited with a configurable
delimeter and produces them to the provided Kafka cluster, topic and partition. In consumer
mode ( -C ), kafkacat reads messages from a topic and partition and prints them to stdout
using the configured message delimiter.
If neither -P or -C are specified kafkacat attempts to figure out the mode automatically
based on stdin/stdout tty types.
kafkacat also features a metadata list mode ( -L ), to display the current state of the
Kafka cluster and its topics and partitions.
3条答案
按热度按时间lx0bsm1f1#
正如@naween banuka所指出的,您还可以使用zookeeper-shell.sh或zkcli.sh(在zookeeper/bin下找到)来执行以下操作:
列出现有主题:
./zookeeper-shell.sh localhost:2181 ls /brokers/topics
删除主题:./zookeeper-shell.sh localhost:2181 rmr /brokers/topics/yourtopic
nwlls2ji2#
根据手册页和github源代码,kafkacat现阶段没有删除主题功能。所以唯一的办法就是用Kafka的主题剧本。
github源代码
手册页
kafkacat是apachekafka0.8的一个通用的非jvm生产者和消费者,可以把它看作kafka的netcat。
cvxl0en23#
是的,有可能。
但首先,必须在所有代理上启用主题删除。改变
delete.topic.enable
至true
. 默认情况下,它是false
(英寸server.properties
文件)然后,使用topic delete命令。
如果要永久删除该主题,可以使用zookeeper delete命令。
列出现有主题:
./zookeeper-shell.sh localhost:2181 ls /brokers/topics
删除主题:./zookeeper-shell.sh localhost:2181 rmr /brokers/topics/yourtopic