zoukankan      html  css  js  c++  java
  • kafka调整offset

    实时平台操作kafka偏移至最早位置操作步骤:
    1、终止任务,并清理状态如果任务开启了状态后端的话;

    2、执行kafka命令,查看所有的group消费分组

    bin/kafka-consumer-groups.sh --bootstrap-server 10.0.32.38:6667,10.0.32.39:6668,10.0.32.40:6669 --list


    3、选择你的任务的groupid

    一般以{Topic名称}_consumer_group_{任务Id} 名称,例如:action_report_topic_consumer_group_225

    4、查看具体分组分区消费信息:

    bin/kafka-consumer-groups.sh --bootstrap-server 10.0.32.38:6667,10.0.32.39:6668,10.0.32.40:6669 --group action_report_topic_consumer_group_225 --describe

    5、移动偏移至最早

    /usr/hdp/3.1.0.0-78/kafka/bin/kafka-consumer-groups.sh --bootstrap-server 10.0.32.38:6667,10.0.32.39:6668,10.0.32.40:6669 --group action_report_topic_consumer_group_225 --reset-offsets --topic TOPIC名字 --to-earliest --execute

    6、移动偏移至最新

    bin/kafka-consumer-groups.sh --bootstrap-server xxx.xxx.xxx.xxx:9092 --group action_report_topic_consumer_group_225 --reset-offsets --topic TOPIC名字 -to-latest --execute

    7、移动相对偏移至
    向早期移动100偏移:

    bin/kafka-consumer-groups.sh --bootstrap-server --bootstrap-server xxx.xxx.xxx.xxx:9092 --group action_report_topic_consumer_group_225 --topic TOPIC名字 --shift-by -100 --reset-offsets --execute


    向后期移动100偏移:

    bin/kafka-consumer-groups.sh --bootstrap-server --bootstrap-server xxx.xxx.xxx.xxx:9092 --group action_report_topic_consumer_group_225 --topic TOPIC名字 --shift-by 100 --reset-offsets --execute


    8、移动到指定时间偏移

    bin/kafka-consumer-groups.sh --bootstrap-server --bootstrap-server xxx.xxx.xxx.xxx:9092 --group action_report_topic_consumer_group_225 --topic TOPIC名字 --to-datetime 2020-11-07T00:00:00.000 --reset-offsets --execute

     

  • 相关阅读:
    HTML-代码定义
    数组
    for。。。for嵌套if,if嵌套for。
    输入年月日, 判断输入的是否正确
    日期功能
    方程
    5.8 一维数组
    5.9 二维数组
    5.7 类
    5.4穷举,迭代
  • 原文地址:https://www.cnblogs.com/qinghe123/p/13948826.html
Copyright © 2011-2022 走看看