kafka basic commands

时间:2023-03-08 15:55:24
kafka basic commands

kafka-server-start.sh config/server.properties &
kafka-server-stop.sh

kafka-topics.sh    --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic kafkatopic
kafka-topics.sh --list --zookeeper localhost:2181
kafka-console-producer.sh --broker-list namenode:9092 --topic kafkatopic
kafka-console-consumer.sh --zookeeper namenode:2181 --topic kafkatopic --from-beginning

1.how to delete topic
删除kafka存储目录(server.properties文件log.dirs配置,默认为"/tmp/kafka-logs")相关topic目录
删除zookeeper "/brokers/topics/"目录下相关topic节点
sample code:
ls /brokers/topics/
rmr /brokers/topics/kafkaToptic

让一个人迅速成长的最简单、最直接也是最有效的办法就是:迅速地让他看到自己的不足
当你有不可思议的目标时,你的人生就必定会有不可思议的改变

2.查看kafka 在zookeeper上面结点的情况
zkCli.sh
ls /
ls /dir/dir/dir/dir/dir