kafka 常用命令
创建topic
bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 3 --partitions 1 --topic my-replicated-topic --config message.timestamp.type=CreateTime
--config 可以指定topic的配置,message.timestamp.type 指定topic的时间戳使用方式,其他配置见
https://kafka.apache.org/docu...
查看topic状态
bin/kafka-topics.sh --describe --bootstrap-server localhost:9092 --topic my-replicated-topic
生产者
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic my-replicated-topic
消费者
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --from-beginning --topic my-replicated-topic
查看segment文件信息
kafka-run-class.sh kafka.tools.DumpLogSegments --print-data-log --files xxxxxxxxxxxx.log