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
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。