kafka相关命令操作

创建 
设置broker*[1-3]的partitions数,副本数2
./bin/kafka-topics.sh --zookeeper localhost:2181 --create --topic testhello --partitions 3 --replication-factor 2

查看
./bin/kafka-topics.sh --zookeeper localhost:2181 --list
查看具体的一个
./bin/kafka-topics.sh --zookeeper localhost:2182 --describe --topic testhello

启动消费者
./bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic testhello

启动生产者
./bin/kafka-console-producer.sh --broker-list localhost:9093 --topic testhello

查看消费组列表
kafka-consumer-groups.sh --bootstrap-server localshot:9092 --list

查看具体消费组的消费offset信息
kafka-consumer-groups.sh --bootstrap-server localshot:9092 --group groupid1  --describe

--to-earliest:把位移调整到分区当前最小位移
--to-latest:把位移调整到分区当前最新位移
--to-current:把位移调整到分区当前位移
--to-offset <offset>: 把位移调整到指定位移处
设置消费组到具体的offset 2530
kafka-consumer-groups.sh --bootstrap-server localshot:9092 --group groupid1  --reset-offsets --topic topic1 --to-offset 2530 --execute

设置消费组到最新offset
kafka-consumer-groups.sh --bootstrap-server localshot:9092 --group groupid1  --reset-offsets --topic topic1 --to-latest --execute

 

 

 

 

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值