Kafka 常用命令

1、启动:
nohup ./bin/kafka-server-start.sh config/server.properties > /dev/null 2>&1 &
2、删除Topic:
./kafka-run-class.sh kafka.admin.DeleteTopicCommand --topic testTopic --zookeeper 192.168.1.101:2181,192.168.1.102:2181,192.168.1.103:2181
3、创建:
./kafka-topics.sh --replication-factor 1 --partition 3 --topic testTopic  --zookeeper 192.168.1.101:2181,192.168.1.102:2181,192.168.1.103:2181 --create
4、显示所有topic: 
./kafka-topics.sh --list --zookeeper 192.168.1.101:2181,192.168.1.102:2181,192.168.1.103:2181
5、显示单个topic情况:
./kafka-topics.sh --describe --topic testTopic --zookeeper 192.168.1.101:2181,192.168.1.102:2181,192.168.1.103:2181
6、发送信息
./kafka-console-producer.sh --broker-list 192.168.1.101:9092,192.168.1.102:9092,192.168.1.103:9092 --topic testTopic 
7、消费信息
./kafka-console-consumer.sh --zookeeper  192.168.1.101:2181,192.168.1.102:2181,192.168.1.103:2181  --from-beginning --topic testTopic
8、查看当前group offset的状况
./kafka-run-class.sh kafka.tools.ConsumerOffsetChecker --group test-group2015
9、表示将offset置到哪里 [earliest | latest]
./kafka-run-class.sh kafka.tools.UpdateOffsetsInZK latest config/consumer.properties testTopic
10、修改分区数量
./kafka-topics.sh --alter --topic testTopic --partitions 34 --zookeeper 192.168.1.101:2181,192.168.1.102:2181,192.168.1.103:2181
阅读更多
个人分类: Kafka
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭