kafka的一些基本命令

kafka:
  brokers: test:8090
  zookeeper:
    servers: test:2181

 1、查看test服务器中的所有topic
bin/kafka-topics.sh --list --zookeeper test:2181
2、创建topic
bin/kafka-topics.sh --create --zookeeper zk01:2181 --replication-factor 1 --partitions 1 --topic test
3、删除topic
bin/kafka-topics.sh --delete --zookeeper zk01:2181 --topic test
需要server.properties中设置delete.topic.enable=true否则只是标记删除或者直接重启。
4、 通过shell命令发送消息
bin/kafka-console-producer.sh --broker-list localhost:8090--topic test
5、 通过shell消费消息
/data/home/ta/kafka_ta/bin/kafka-console-consumer.sh --zookeeper test1:2181,test2:2181,test3:2181 --from-beginning --topic ta-data
6、查看消费位置
/data/home/ta/kafka_ta/bin/kafka-run-class.sh kafka.tools.ConsumerOffsetChecker --zookeeper test1:2181,test2:2181,test3:2181 --group taRealtimeEtlGroup
/data/home/ta/kafka_ta/bin/kafka-consumer-groups.sh --zookeeper test1:2181,test2:2181,test3:2181 --describe --group taRealtimeEtlGroup
?    查看某个Topic的详情
bin/kafka-topics.sh --topic ta_optimize --describe --zookeeper test:2181


查看详情
bin/kafka-topics.sh --zookeeper test1:2181,test2:2181,test3:2181 --describe

/data/home/ta/kafka_ta/bin/kafka-simple-consumer-shell.sh --broker-list test:9092 --topic ta-data --partition 4
bin/kafka-simple-consumer-shell.sh --broker-list test1:9092,test2:9092 --topic ta-data --print-offsets --partition 4 --offset 1357192118 --replica 1

bin/kafka-simple-consumer-shell.sh --broker-list test2:9092,test2:9092 --topic ta-data --print-offsets --partition 4 --offset 155982315

 

kafka的一些配置学习
https://www.jianshu.com/p/578adecf2622

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值