kafka-5-常用命令

kafka 常用命令

  1. 创建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...

  2. 查看topic状态

    bin/kafka-topics.sh --describe --bootstrap-server localhost:9092 --topic my-replicated-topic
  3. 生产者

    bin/kafka-console-producer.sh --broker-list localhost:9092 --topic my-replicated-topic
  4. 消费者

    bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --from-beginning --topic my-replicated-topic
  5. 查看segment文件信息

    kafka-run-class.sh kafka.tools.DumpLogSegments --print-data-log --files xxxxxxxxxxxx.log

你可能感兴趣的:(kafka)