Kafka常用命令

1、启动kafka

./bin/kafka-server-start.sh -daemon config/server.properties &

2、列出已创建的topic列表

./bin/kafka-topics.sh --list --zookeeper localhost:2181

3、创建topic–test

./bin/kafka-topics.sh --create --zookeeper dfs1a1.ecld.com:2181 --replication-factor 1 --partitions 1 --topic test_zql

4、模拟客户端去发送消息

./bin/kafka-console-producer.sh --broker-list dfs1a1.ecld.com:6667 --topic test_zql --security-protocol PLAINTEXTSASL

5、模拟客户端去消费消息

./bin/kafka-console-consumer.sh --zookeeper dfs1a1.ecld.com:2181 --topic test_zql --from-beginning --security-protocol PLAINTEXTSASL

6、查看指定的主题

./bin/kafka-topics.sh --describe --zookeeper dfs1a1.ecld.com:2181 --topic test_zql
posted @ 2018-05-06 18:10  章三丰  阅读(186)  评论(0)    收藏  举报