当前位置: 首页 > news >正文

kafka-消费者组偏移量重置

文章目录

  • 1、消费者组偏移量重置
    • 1.1、列出所有的消费者组
    • 1.2、查看 my_group1 组的详细信息
    • 1.3、获取 kafka-consumer-groups.sh 的帮助信息
    • 1.4、 偏移量重置
    • 1.5、再次查看 my_group1 组的详细信息

1、消费者组偏移量重置

1.1、列出所有的消费者组

[root@localhost ~]# kafka-consumer-groups.sh --bootstrap-server 192.168.74.148:9092 --list
my_group2
my_group1

1.2、查看 my_group1 组的详细信息

[root@localhost ~]# kafka-consumer-groups.sh --bootstrap-server 192.168.74.148:9092 --group my_group1 --describeGROUP           TOPIC           PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG             CONSUMER-ID                                               HOST            CLIENT-ID
my_group1       my_topic1       1          1               1               0               consumer-my_group1-1-c2ff5a19-af5c-47fc-9ad9-d6028844f86c /192.168.74.148 consumer-my_group1-1
my_group1       my_topic1       2          3               3               0               consumer-my_group1-1-c6a31cdb-c924-49bb-99da-cf45ffdbefb6 /192.168.74.148 consumer-my_group1-1
my_group1       my_topic1       0          2               2               0               consumer-my_group1-1-19852a4a-9a4e-4b41-b605-0a78530d0cd8 /192.168.74.148 consumer-my_group1-1

1.3、获取 kafka-consumer-groups.sh 的帮助信息

[root@localhost ~]# kafka-consumer-groups.sh --help
Missing required argument "[bootstrap-server]"
Option                                  Description                            
------                                  -----------                            
--all-groups                            Apply to all consumer groups.          
--all-topics                            Consider all topics assigned to a      group in the `reset-offsets` process.
--bootstrap-server <String: server to   REQUIRED: The server(s) to connect to. connect to>                                                                  
--by-duration <String: duration>        Reset offsets to offset by duration    from current timestamp. Format:      'PnDTnHnMnS'                         
--command-config <String: command       Property file containing configs to be config property file>                   passed to Admin Client and Consumer. 
--delete                                Pass in groups to delete topic         partition offsets and ownership      information over the entire consumer group. For instance --group g1 --    group g2                             
--delete-offsets                        Delete offsets of consumer group.      Supports one consumer group at the   time, and multiple topics.           
--describe                              Describe consumer group and list       offset lag (number of messages not   yet processed) related to given      group.                               
--dry-run                               Only show results without executing    changes on Consumer Groups.          Supported operations: reset-offsets. 
--execute                               Execute operation. Supported           operations: reset-offsets.           
--export                                Export operation execution to a CSV    file. Supported operations: reset-   offsets.                             
--from-file <String: path to CSV file>  Reset offsets to values defined in CSV file.                                
--group <String: consumer group>        The consumer group we wish to act on.  
--help                                  Print usage information.               
--list                                  List all consumer groups.              
--members                               Describe members of the group. This    option may be used with '--describe' and '--bootstrap-server' options     only.                                Example: --bootstrap-server localhost: 9092 --describe --group group1 --    members                              
--offsets                               Describe the group and list all topic  partitions in the group along with   their offset lag. This is the        default sub-action of and may be     used with '--describe' and '--       bootstrap-server' options only.      Example: --bootstrap-server localhost: 9092 --describe --group group1 --    offsets                              
--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-period, --to-earliest, --to-    latest, --shift-by, --from-file, --  to-current.                          To define the scope use --all-topics   or --topic. One scope must be        specified unless you use '--from-    file'.                               
--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                                When specified with '--list', it       displays the state of all groups. It can also be used to list groups with specific states.                     Example: --bootstrap-server localhost: 9092 --list --state stable,empty     This option may be used with '--       describe', '--list' and '--bootstrap-server' options only.                
--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)       
--to-current                            Reset offsets to current offset.       
--to-datetime <String: datetime>        Reset offsets to offset from datetime. Format: 'YYYY-MM-DDTHH:mm:SS.sss'    
--to-earliest                           Reset offsets to earliest offset.      
--to-latest                             Reset offsets to latest offset.        
--to-offset <Long: offset>              Reset offsets to a specific offset.    
--topic <String: topic>                 The topic whose consumer group         information should be deleted or     topic whose should be included in    the reset offset process. In `reset- offsets` case, partitions can be     specified using this format: `topic1:0,1,2`, where 0,1,2 are the          partition to be included in the      process. Reset-offsets also supports multiple topic inputs.               
--verbose                               Provide additional information, if     any, when describing the group. This option may be used with '--          offsets'/'--members'/'--state' and   '--bootstrap-server' options only.   Example: --bootstrap-server localhost: 9092 --describe --group group1 --    members --verbose                    
--version                               Display Kafka version.  

1.4、 偏移量重置

[root@localhost ~]# kafka-consumer-groups.sh --bootstrap-server 192.168.74.148:9092 --topic my_topic1 --group my_group1 --reset-offsets --to-offset 1 --executeGROUP                          TOPIC                          PARTITION  NEW-OFFSET     
my_group1                      my_topic1                      0          1              
my_group1                      my_topic1                      1          1              
my_group1                      my_topic1                      2          1   

在这里插入图片描述

1.5、再次查看 my_group1 组的详细信息

[root@localhost ~]# kafka-consumer-groups.sh --bootstrap-server 192.168.74.148:9092 --group my_group1 --describeGROUP           TOPIC           PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG             CONSUMER-ID                                               HOST            CLIENT-ID
my_group1       my_topic1       0          2               2               0               consumer-my_group1-1-1306dc19-4077-4622-ae3b-ed6d077c4206 /192.168.74.148 consumer-my_group1-1
my_group1       my_topic1       2          3               3               0               consumer-my_group1-1-c4e3e804-e469-4f1a-ac0c-5b57907356f9 /192.168.74.148 consumer-my_group1-1
my_group1       my_topic1       1          1               1               0               consumer-my_group1-1-ad5fc413-e598-4e4b-b44c-0ae976a615c8 /192.168.74.148 consumer-my_group1-1

相关文章:

kafka-消费者组偏移量重置

文章目录 1、消费者组偏移量重置1.1、列出所有的消费者组1.2、查看 my_group1 组的详细信息1.3、获取 kafka-consumer-groups.sh 的帮助信息1.4、 偏移量重置1.5、再次查看 my_group1 组的详细信息 1、消费者组偏移量重置 1.1、列出所有的消费者组 [rootlocalhost ~]# kafka-…...

一书读懂Python全栈安全,剑指网络空间安全

写在前面 通过阅读《Python全栈安全/网络空间安全丛书》&#xff0c;您将能够全面而深入地理解Python全栈安全的广阔领域&#xff0c;从基础概念到高级应用无一遗漏。本书不仅详细解析了Python在网络安全、后端开发、数据分析及自动化等全栈领域的安全实践&#xff0c;还紧密贴…...

原生js实现拖拽改变元素顺序

代码展示如下&#xff1a; <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title>Document</title>…...

以果决其行,只为文化的传承

从他们每一个人的身上&#xff0c;我们看到传神的东西&#xff0c;就是他们都能用结果&#xff0c;去指引自己前进的方向&#xff0c;这正是我要解读倪海厦老师的原因&#xff0c;看倪海厦2012年已经去世&#xff0c;到现在已经十几年时间了&#xff0c;但是我们看现在自学中医…...

Flutter 中的 SizedOverflowBox 小部件:全面指南

Flutter 中的 SizedOverflowBox 小部件&#xff1a;全面指南 在 Flutter 的布局世界中&#xff0c;SizedOverflowBox 是一个相对独特的小部件&#xff0c;它允许子组件溢出其父组件的界限&#xff0c;同时保持父组件的尺寸不变。这在某些特定的布局场景下非常有用&#xff0c;…...

图像视频智能抹除修复解决方案,适应性强,应用广泛

行车录制、现场拍摄等过程中&#xff0c;往往会出现一些难以避免的瑕疵——遮挡物、无关人员、甚至是意外的光线变化&#xff0c;这些都可能影响到视频与图像的质量&#xff0c;降低其观赏性和专业性。 美摄科技&#xff0c;作为行业领先的图像视频智能处理专家&#xff0c;深…...

20240521(代码整洁和测试入门学习)

测试: 1.测试工程师、测试工具开发工程师、自动化测试工程师。 python&#xff1a; 1、发展背景和优势&#xff1b; 2、开始多需的工具 interpreter(解释器) refactor(重构) 2、变量和注释的基础语法 3、输入输出 i 1 for i in range(1, 11): print(i, end ) 不换行打印…...

git中忽略文件的配置

git中忽略文件的配置 一、在项目根目录下创建.gitignore文件二、配置规则如果在配置之前已经提交过文件了&#xff0c;要删除提交过的&#xff0c;如何修改&#xff0c;参考下面的 一、在项目根目录下创建.gitignore文件 .DS_Store node_modules/ /dist# local env files .env…...

如何进行前端职业规划

目录 找准自身定位 未来发展方向 扬长避短很有效 你的出处并不能代表什么 将目标放长放远 职业发展中面临的选择 全栈 or 纯前端? ToB or ToC 赚钱 or 个人成长? 分析每个阶段的需求 为什么不可以一边赚钱一边做喜欢的事情呢 我们还没离开校园的时候,就已经知道要…...

GD32F103系列单片机片上FLASH和ARM介绍

本文章基于兆易创新GD32 MCU所提供的2.2.4版本库函数开发 后续项目主要在下面该专栏中发布&#xff1a; 手把手教你嵌入式国产化_不及你的温柔的博客-CSDN博客 感兴趣的点个关注收藏一下吧! 电机驱动开发可以跳转&#xff1a; 手把手教你嵌入式国产化-实战项目-无刷电机驱动&am…...

Ansible自动化运维中的Setup收集模块应用详解

作者主页&#xff1a;点击&#xff01; Ansible专栏&#xff1a;点击&#xff01; 创作时间&#xff1a;2024年5月22日13点14分 &#x1f4af;趣站推荐&#x1f4af; 前些天发现了一个巨牛的&#x1f916;人工智能学习网站&#xff0c;通俗易懂&#xff0c;风趣幽默&#xf…...

再次学习History.scrollRestoration

再次学习History.scrollRestoration 之前在react.dev的源代码中了解到了这个HIstory的属性&#xff0c;当时写了一篇笔记来记录我对它的理解&#xff0c;现在看来还是一知半解。所以今天打算重新学习一下这个属性&#xff0c;主要从属性以及所属对象的介绍、使用方法&#xff0…...

python PyQt5 数字时钟程序

效果图&#xff1a; 概述 本文档将指导您如何使用Python的PyQt5库创建一个简单的时钟程序。该程序将显示当前时间&#xff0c;并具有以下特性&#xff1a; 始终在最前台显示。窗口可拖动。鼠标右键点击窗口可弹出退出菜单。时间标签具有红色渐变效果。窗口初始化时出现在屏幕…...

骨传导耳机哪个品牌值得入手?精选五大不容错过的王者品牌推荐!

尽管骨传导耳机作为新型蓝牙耳机问世不久&#xff0c;但凭借其独特的传音方式和舒适的佩戴体验&#xff0c;已经迅速在市场上崭露头角&#xff0c;赢得了广大音乐爱好者和运动达人的青睐。然而&#xff0c;随着骨传导耳机热度增高&#xff0c;市场上开始出现一些品质参差不齐的…...

Vue.js|项目安装

根据Vue脚手架创建出来的项目目录&#xff1a; 运行项目&#xff1a; 控制台中输入下面的命令&#xff1a; npm run serve 修改vue项目运行端口&#xff1a; 前往vue.config.js中添加下面的代码&#xff1a; devServer: {port: 7000} 接着前往控制台输入Ctrlc关闭项目&…...

多线程新手村4--定时器

定时器是日常开发中很常见的组件&#xff0c;定时器大家可能不知道是干什么的&#xff0c;但是定时炸弹肯定都听过&#xff0c;定个时间&#xff0c;过一段时间后bomb&#xff01;&#xff01;&#xff01;爆炸 定时器的逻辑和这个一样&#xff0c;约定一个时间&#xff0c;这…...

如何衡量安全阀检测的价格与价值?一文揭晓答案

安全阀作为工业设备中的重要组件&#xff0c;其性能的稳定性和可靠性直接影响着整个系统的安全运行。因此&#xff0c;对安全阀进行定期检测和维护显得尤为重要。 那么&#xff0c;安全阀检测一个需要多少钱呢&#xff1f; 在这篇文章中&#xff0c;佰德将从检测费用构成、市…...

Sectigo证书介绍以及申请流程

Sectigo (原Comodo CA)是全球SSL证书市场占有率最高的CA公司&#xff0c;目前将近40%的SSL证书用户选择了Sectigo。由于其产品安全&#xff0c;价格低&#xff0c;受到大量站长的信任和欢迎。Sectigo旗下的SSL证书品牌包括Sectigo, Positive SSL, Sectigo Enterprise等。 品牌…...

网络安全-钓鱼篇-利用cs进行钓鱼

一、环境 自行搭建&#xff0c;kill&#xff0c;Windows10&#xff0c;cs 二、原理 如图所示 三、钓鱼演示 首先第一步&#xff1a;打开System Profiler-分析器功能 选择克隆www.baidu.com页面做钓鱼 之后我们通过包装域名&#xff0c;各种手段让攻击对象访问&#xff1a;h…...

机器学习-6-对随机梯度下降算法SGD的理解

参考一文带您了解随机梯度下降(Stochastic Gradient Descent):python代码示例 参考sklearn-SGDClassifier 1 梯度下降 在机器学习领域,梯度下降扮演着至关重要的角色。梯度下降是一种优化算法,通过迭代沿着由梯度定义的最陡下降方向,以最小化函数。类似于图中的场景,可以…...

FastAPI 教程:从入门到实践

FastAPI 是一个现代、快速&#xff08;高性能&#xff09;的 Web 框架&#xff0c;用于构建 API&#xff0c;支持 Python 3.6。它基于标准 Python 类型提示&#xff0c;易于学习且功能强大。以下是一个完整的 FastAPI 入门教程&#xff0c;涵盖从环境搭建到创建并运行一个简单的…...

Python爬虫实战:研究feedparser库相关技术

1. 引言 1.1 研究背景与意义 在当今信息爆炸的时代,互联网上存在着海量的信息资源。RSS(Really Simple Syndication)作为一种标准化的信息聚合技术,被广泛用于网站内容的发布和订阅。通过 RSS,用户可以方便地获取网站更新的内容,而无需频繁访问各个网站。 然而,互联网…...

oracle与MySQL数据库之间数据同步的技术要点

Oracle与MySQL数据库之间的数据同步是一个涉及多个技术要点的复杂任务。由于Oracle和MySQL的架构差异&#xff0c;它们的数据同步要求既要保持数据的准确性和一致性&#xff0c;又要处理好性能问题。以下是一些主要的技术要点&#xff1a; 数据结构差异 数据类型差异&#xff…...

P3 QT项目----记事本(3.8)

3.8 记事本项目总结 项目源码 1.main.cpp #include "widget.h" #include <QApplication> int main(int argc, char *argv[]) {QApplication a(argc, argv);Widget w;w.show();return a.exec(); } 2.widget.cpp #include "widget.h" #include &q…...

Matlab | matlab常用命令总结

常用命令 一、 基础操作与环境二、 矩阵与数组操作(核心)三、 绘图与可视化四、 编程与控制流五、 符号计算 (Symbolic Math Toolbox)六、 文件与数据 I/O七、 常用函数类别重要提示这是一份 MATLAB 常用命令和功能的总结,涵盖了基础操作、矩阵运算、绘图、编程和文件处理等…...

Linux 中如何提取压缩文件 ?

Linux 是一种流行的开源操作系统&#xff0c;它提供了许多工具来管理、压缩和解压缩文件。压缩文件有助于节省存储空间&#xff0c;使数据传输更快。本指南将向您展示如何在 Linux 中提取不同类型的压缩文件。 1. Unpacking ZIP Files ZIP 文件是非常常见的&#xff0c;要在 …...

搭建DNS域名解析服务器(正向解析资源文件)

正向解析资源文件 1&#xff09;准备工作 服务端及客户端都关闭安全软件 [rootlocalhost ~]# systemctl stop firewalld [rootlocalhost ~]# setenforce 0 2&#xff09;服务端安装软件&#xff1a;bind 1.配置yum源 [rootlocalhost ~]# cat /etc/yum.repos.d/base.repo [Base…...

C#学习第29天:表达式树(Expression Trees)

目录 什么是表达式树&#xff1f; 核心概念 1.表达式树的构建 2. 表达式树与Lambda表达式 3.解析和访问表达式树 4.动态条件查询 表达式树的优势 1.动态构建查询 2.LINQ 提供程序支持&#xff1a; 3.性能优化 4.元数据处理 5.代码转换和重写 适用场景 代码复杂性…...

Ubuntu Cursor升级成v1.0

0. 当前版本低 使用当前 Cursor v0.50时 GitHub Copilot Chat 打不开&#xff0c;快捷键也不好用&#xff0c;当看到 Cursor 升级后&#xff0c;还是蛮高兴的 1. 下载 Cursor 下载地址&#xff1a;https://www.cursor.com/cn/downloads 点击下载 Linux (x64) &#xff0c;…...

LOOI机器人的技术实现解析:从手势识别到边缘检测

LOOI机器人作为一款创新的AI硬件产品&#xff0c;通过将智能手机转变为具有情感交互能力的桌面机器人&#xff0c;展示了前沿AI技术与传统硬件设计的完美结合。作为AI与玩具领域的专家&#xff0c;我将全面解析LOOI的技术实现架构&#xff0c;特别是其手势识别、物体识别和环境…...