Kafka 偏移量操作

131 阅读1分钟

#### 查看偏移量
/kafka-consumer-groups.sh --bootstrap-server --group –-describe

#### 重置指定主题的偏移量位置

/kafka-consumer-groups.sh --bootstrap-server --group --topic --reset-offsets --execute

position 取值如下:
--to-earliest 调整到当前最小位移 

--to-latest 调整到当前最新位移 

--to-current 调整到当前位移 

--to-offset 调整到指定位移 

--shift-by N 当前位移 + N,N可以是负数,表示向前移动 

--to-datetime 大于指定时间的最小位移 

--by-duration 距离当前时间指定间隔的位移 

--from-file 从文件中读取策略