Kafka问题排查命令

编程

kafak的bin目录

cd kafka_2.11-1.1.0/bin/

1 查看topic

./kafka-topics.sh --list --zookeeper 0.0.0.0:2181/kafka

2 创建topic长度

./kafka-topics.sh --create --zookeeper 0.0.0.0:2181 --replication-factor 3 --partitions 1 --topic topic1

./kafka-topics.sh --create --zookeeper 0.0.0.0:2181 --replication-factor 1 --partitions 1 --topic TEST_RMR

3 生产kafka消息

./kafka-console-producer.sh --broker-list 0.0.0.0:29091,0.0.0.0:29091,0.0.0.0:29091 --topic test

4消费topic

./kafka-console-consumer.sh --bootstrap-server 0.0.0.0:29091,0.0.0.0:29091,0.0.0.0:29091 --topic test --from-beginning

./kafka-console-consumer.sh --bootstrap-server 0.0.0.0:29091,0.0.0.0:29091,0.0.0.0:29091 --topic test |grep ""POSITION_CODE": "3""

5 查看消息kafka消费情况

./kafka-consumer-offset-checker.sh --group mcd-ec --topic test --zookeeper 0.0.0.0:2182

./kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list 0.0.0.0:29091,0.0.0.0:29091,0.0.0.0:29091 --topic test --time 100000

./kafka-run-class.sh kafka.tools.ConsumerOffsetChecker --zookeeper 0.0.0.0:2181 --topic test

./kafka-run-class.sh kafka.tools.ConsumerOffsetChecker --zookeeper 0.0.0.0:2181 --topic test --group group1

 

以上是 Kafka问题排查命令 的全部内容, 来源链接: utcz.com/z/515643.html

回到顶部