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