kafka:
brokers: test:8090
zookeeper:
servers: test:2181
1、查看test服务器中的所有topic
bin/kafka-topics.sh --list --zookeeper test:2181
2、创建topic
bin/kafka-topics.sh --create --zookeeper zk01:2181 --replication-factor 1 --partitions 1 --topic test
3、删除topic
bin/kafka-topics.sh --delete --zookeeper zk01:2181 --topic test
需要server.properties中设置delete.topic.enable=true否则只是标记删除或者直接重启。
4、 通过shell命令发送消息
bin/kafka-console-producer.sh --broker-list localhost:8090--topic test
5、 通过shell消费消息
/data/home/ta/kafka_ta/bin/kafka-console-consumer.sh --zookeeper test1:2181,test2:2181,test3:2181 --from-beginning --topic ta-data
6、查看消费位置
/data/home/ta/kafka_ta/bin/kafka-run-class.sh kafka.tools.ConsumerOffsetChecker --zookeeper test1:2181,test2:2181,test3:2181 --group taRealtimeEtlGroup
/data/home/ta/kafka_ta/bin/kafka-consumer-groups.sh --zookeeper test1:2181,test2:2181,test3:2181 --describe --group taRealtimeEtlGroup
? 查看某个Topic的详情
bin/kafka-topics.sh --topic ta_optimize --describe --zookeeper test:2181
查看详情
bin/kafka-topics.sh --zookeeper test1:2181,test2:2181,test3:2181 --describe
/data/home/ta/kafka_ta/bin/kafka-simple-consumer-shell.sh --broker-list test:9092 --topic ta-data --partition 4
bin/kafka-simple-consumer-shell.sh --broker-list test1:9092,test2:9092 --topic ta-data --print-offsets --partition 4 --offset 1357192118 --replica 1
bin/kafka-simple-consumer-shell.sh --broker-list test2:9092,test2:9092 --topic ta-data --print-offsets --partition 4 --offset 155982315
kafka的一些配置学习
https://www.jianshu.com/p/578adecf2622