1、查看kafka的topic

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

2、查看topic明细

kafka-topics.sh --zookeeper localhost:2181 --desc --topic demo

3、创建kafka topic,10个分区1个副本

kafka-topics.sh --zookeeper localhost:2181 --create --topic demo --partitions 10 --replication-factor 1

4、增加分区到20个

kafka-topics.sh --zookeeper localhost:2181 --alter --topic demo --partitions 20

5、删除topic

kafka-topics.sh --zookeeper localhost:2181 --delete --topic demo

6、生产

kafka-console-producer.sh --broker-list localhost:9092 --topic demo

7、消费

kafka-console-consumer.sh --zookeeper localhost:2181 --topic demo

kafka-console-consumer.sh --zookeeper localhost:2181 --topic demo --from-beginning

8、其他 

#kafka.consumer.zkServers=10.202.24.5:2181,10.202.24.6:2181,10.202.24.7:2181

10.202.24.5:9095,10.202.24.6:9095,10.202.24.7:9095


./kafka-console-consumer.sh --zookeeper 10.202.24.5:2181,10.202.24.6:2181,10.202.24.7:2181/kafka/other2 --topic __consumer_offsets --formatter "kafka.coordinator.group.GroupMetadataManager\$OffsetsMessageFormatter"  --from-beginning

./kafka-console-consumer.sh --zookeeper 10.202.24.5:2181,10.202.24.6:2181,10.202.24.7:2181/kafka/other2 --topic __consumer_offsets --consumer.config ../config/consumer.properties  --from-beginning

./kafka-consumer-groups.sh --zookeeper 10.202.24.5:2181,10.202.24.6:2181,10.202.24.7:2181/kafka/car --describe --group test-group-1


kafka-console-producer.sh --broker-list 10.202.34.200:9092,10.202.34.201:9092,10.202.34.202:9092 --topic OMS_APPOINTMENT_REQUEST_NEW_SGSIF


./kafka-run-class.sh kafka.tools.GetOffsetShell --topic AIR_AIS_CORE_CAPACITY_INFO --time -1 --broker-list 10.202.24.7:9096 

AIR_AIS_CORE_CAPACITY_INFO:2:12004243
AIR_AIS_CORE_CAPACITY_INFO:1:11894060
AIR_AIS_CORE_CAPACITY_INFO:3:11935372
AIR_AIS_CORE_CAPACITY_INFO:0:10670742





./kafka-topics.sh --zookeeper 10.202.24.5:2181/kafka/bus --alter --topic AIR_AIS_CORE_CAPACITY_INFO --config replica.fetch.max.bytes=3096000

 ./kafka-console-consumer.sh --zookeeper 10.202.24.5:2181,10.202.24.6:2181,10.202.24.7:2181/kafka/other2 --topic __consumer_offsets --formatter "kafka.coordinator.group.GroupMetadataManager\$OffsetsMessageFormatter"  --from-beginning

 ./kafka-console-consumer.sh --zookeeper 10.202.24.5:2181,10.202.24.6:2181,10.202.24.7:2181/kafka/other2 --topic AIR_AIS_CORE_CAPACITY_INFO --formatter "kafka.coordinator.group.GroupMetadataManager\$OffsetsMessageFormatter"  --from-beginning

 ./kafka-console-consumer.sh --zookeeper 10.202.24.5:2181,10.202.24.6:2181,10.202.24.7:2181/kafka/other2 --topic AIR_AIS_CORE_CAPACITY_INFO --consumer.config ../config/consumer.properties  --from-beginning

./kafka-consumer-offset-checker.sh --zookeeper 10.203.0.181:2181,10.203.0.183:2181,10.203.0.184:2181,10.203.0.185:2181,10.203.0.186:2181/kafka/cloud --topic AIR_AIS_CORE_CAPACITY_INFO --group *

 

posted on 2020-08-26 15:37  架构艺术  阅读(183)  评论(0编辑  收藏  举报