kafka 的常用命令

若是127.0.0.1 不可访问,则查看kafka配置文件中 配置的真实ip 是多少

启动kafka:
./kafka-server-start.sh ../config/server.properties 1>/dev/null 2>&1 &     # kafka-server-start.sh 脚本在 kafka_2.12-2.2.0/bin路径下



查看所有topic
./bin/kafka-topics.sh --list --zookeeper localhost:2181
查看对应topic的描述信息: 
./kafka-topics.sh --describe --zookeeper xx.x.xxx.xxx:2181 --topic xxxxx.xx.xxxxx.xxx     # --zookeeper为zookeeperIP, --topic为topic名称 
消费消息:
./kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic xxxxx.xx.xxxxx.xxx --from-beginning 
删除topic
./bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic  topic1

查看所有消费者
./bin/kafka-consumer-groups.sh --bootstrap-server 127.0.0.1:9092 --list --new-consumer  

查看某个消费者的 消费情况
./bin/kafka-consumer-groups.sh --bootstrap-server 127.0.0.1:9092 --describe --group groupName 

./bin/kafka-consumer-groups.sh --bootstrap-server 127.0.0.1:9092 --describe --group groupName | awk '{p +=$3;t += $4;sum += $5};END {print p,t,sum}'


创建测试 topic
bin/kafka-topics.sh -zookeeper localhost:2181 --create --partitions 5 --replication-factor 1 --topic test765
生产测试消息
为 topic test765 生产 500000 条消息:
bin/kafka-producer-perf-test.sh  --topic test765 --throughput  -1  --record-size 10 --num-records 




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值