kafka-5-经常使用命令

kafka 经常使用命令

  1. 建立topicapache

    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的时间戳使用方式,其余配置见bootstrap

    https://kafka.apache.org/docu...code

  2. 查看topic状态server

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

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

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

    kafka-run-class.sh kafka.tools.DumpLogSegments --print-data-log --files xxxxxxxxxxxx.log
相关文章
相关标签/搜索