- 查看所有的消费者组里有哪些成员
PS C:\Users\chenjing\kafka_2.12-3.3.1> .\bin\windows\kafka-consumer-groups.bat --bootstrap-server 192.168.31.253:9092 --all-groups --describe --membersGROUPCONSUMER-IDHOSTCLIENT-ID#PARTITIONSCountryCounterchenjing_client-42cc37c6-695f-4c47-b844-764a3d2169d3 /111.18.132.232 chenjing_client 2GROUPCONSUMER-IDHOSTCLIENT-ID#PARTITIONSOrderCounterclient_2-26992db5-d5ab-4252-a219-995bdbe37388 /111.18.132.232 client_22
--reset-offsets
Reset offsets of consumer group. Supports one consumer group at the time, and instances should be inactive.
Has 2 execution options: --dry-run (the default) to plan which offsets to reset, and --execute to update the offsets. Additionally, the --export option is used to export the results to a CSV format.
You must choose one of the following reset specifications: --to-datetime, --by-duration, --to-earliest, --to-latest, --shift-by, --from-file, --to-current, --to-offset.
To define the scope use --all-topics or --topic. One scope must be specified unless you use '--from-file'.重置消费者组的偏移量 。如果执行消费者组,一次只能指定一个消费组(需要提前关闭相关的消费者和生产者) 。有两个执行参数:
--dry-run
(默认值)用于打印计划要重置的偏移量 , 以及 --execute
以更新偏移量 。此外,--export
选项用于将结果导出为 CSV 格式 。必须选择以下重置类型之一(关于这些重置类型的更多参考请查看 官方文档):--to-datetime
, --by-duration
, --to-earliest
, --to-latest
, --shift-by
, --from-file
, --to-current
, --to-offset
。例如(以下所有命令均使用
--dry-run
参数打印执行计划,如果执行计划符合你的期望 , 请把 --dry-run
替换为 --execute
以真正更新偏移量):- 重置指定消费组的所有Topic的偏移量
PS C:\Users\chenjing\kafka_2.12-3.3.1> .\bin\windows\kafka-consumer-groups.bat --bootstrap-server 192.168.31.253:9092 --reset-offsets --to-earliest --group CountryCounter --dry-run --all-topicsGROUPTOPICPARTITIONNEW-OFFSETCountryCounteruser_card10CountryCounteruser_card0521CountryCounteruser_card20CountryCountert100
- 重置指定消费组的指定Topic的偏移量
PS C:\Users\chenjing\kafka_2.12-3.3.1> .\bin\windows\kafka-consumer-groups.bat --bootstrap-server 192.168.31.253:9092 --reset-offsets --to-earliest --group CountryCounter --dry-run --topic t1GROUPTOPICPARTITIONNEW-OFFSETCountryCountert100
- 重置所有消费组的所有Topic的偏移量
PS C:\Users\chenjing\kafka_2.12-3.3.1> .\bin\windows\kafka-consumer-groups.bat --bootstrap-server 192.168.31.253:9092 --reset-offsets --to-earliest --all-groups --dry-run --all-topicsGROUPTOPICPARTITIONNEW-OFFSETOrderCountert220OrderCountert100OrderCountert210OrderCountert200CountryCounteruser_card10CountryCounteruser_card0521CountryCounteruser_card20CountryCountert100
- 重置所有消费组中指定Topic的偏移量
PS C:\Users\chenjing\kafka_2.12-3.3.1> .\bin\windows\kafka-consumer-groups.bat --bootstrap-server 192.168.31.253:9092 --reset-offsets --to-earliest --all-groups --dry-run --topic t1GROUPTOPICPARTITIONNEW-OFFSETOrderCountert100CountryCountert100
--shift-by <Long: number-of-offsets>
Reset offsets shifting current offset by 'n', where 'n' can be positive or negative.
--state [String]
When specified with '--describe', includes the state of the group. Example: --bootstrap-server localhost:9092 --describe --group group1 --state和
--describe
配合使用,列出消费者组的状态 。例如:- 列出指定消费者组的状态
PS C:\Users\chenjing\kafka_2.12-3.3.1> .\bin\windows\kafka-consumer-groups.bat --bootstrap-server 192.168.31.253:9092 --group CountryCounter --describe --stateGROUPCOORDINATOR (ID)ASSIGNMENT-STRATEGYSTATE#MEMBERSCountryCounter192.168.31.253:9092 (0)rangeStable1
- 列出所有消费者组的状态
PS C:\Users\chenjing\kafka_2.12-3.3.1> .\bin\windows\kafka-consumer-groups.bat --bootstrap-server 192.168.31.253:9092 --all-groups --describe --stateGROUPCOORDINATOR (ID)ASSIGNMENT-STRATEGYSTATE#MEMBERSCountryCounter192.168.31.253:9092 (0)rangeStable1GROUPCOORDINATOR (ID)ASSIGNMENT-STRATEGYSTATE#MEMBERSOrderCounter192.168.31.253:9092 (0)rangeStable1
--timeout <Long: timeout (ms)>
The timeout that can be set for some use cases. For example, it can be used when describing the group to specify the maximum amount of time in milliseconds to wait before the group stabilizes (when the group is just created, or is going through some changes). (default: 5000)推荐阅读
- JavaScript常用工具函数
- 2 onps栈使用说明——ping、域名解析等网络工具测试
- 安卓手机怎么截屏和截图(手机最强的截图工具)
- JVM调优工具使用手册
- 要写文档了,emmm,先写个文档工具吧——DocMarkdown
- chrome工具调试
- 怎么破解DLL文件(dll文件反编译工具)
- 重新整理 .net core 实践篇 ———— linux上排查问题实用工具 [外篇]
- TensorFlow?PyTorch?Paddle?AI工具库生态之争:ONNX将一统天下
- mlflow详细安装部署