Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot 偏移量超出范围重置偏移量第二消费组_Spring Boot_Apache Kafka_Kafka Consumer Api_Spring Kafka - Fatal编程技术网

Spring boot 偏移量超出范围重置偏移量第二消费组

Spring boot 偏移量超出范围重置偏移量第二消费组,spring-boot,apache-kafka,kafka-consumer-api,spring-kafka,Spring Boot,Apache Kafka,Kafka Consumer Api,Spring Kafka,当单个主题被两个不同的消费群体消费时,偏移量被重置 我使用的是卡夫卡版本0.10.1.0和春季卡夫卡版本2.2.4。 我在主题“topic_X”中生成了一条消息,这条消息应该由两个不同的消费群体“consumerA”和“consumerB”消费,每个消费群体只有一个消费者 假设“consumerB”停止运行,我已经在“topic_X”上生成了100条消息,“consumerA”已经运行并使用了所有消息。当我再次调高“connumberb”时,偏移量设置为100,而不是从0开始 我已经尝试设置自动

当单个主题被两个不同的消费群体消费时,偏移量被重置

我使用的是卡夫卡版本0.10.1.0和春季卡夫卡版本2.2.4。 我在主题“topic_X”中生成了一条消息,这条消息应该由两个不同的消费群体“consumerA”和“consumerB”消费,每个消费群体只有一个消费者

假设“consumerB”停止运行,我已经在“topic_X”上生成了100条消息,“consumerA”已经运行并使用了所有消息。当我再次调高“connumberb”时,偏移量设置为100,而不是从0开始

我已经尝试设置自动偏移重置:最早,但仍然不工作。下面是我从控制台得到的日志

当我启动“consumberB”时,我不想重置偏移量,如何才能做到这一点

2019-05-15 11:28:44.309  INFO 16152 --- [eted-Data-0-C-1] o.a.k.c.c.internals.AbstractCoordinator  : [Consumer clientId=consumer-4, groupId=consumer_group] (Re-)joining group
2019-05-15 11:28:44.536  INFO 16152 --- [ment-Data-0-C-1] o.a.k.c.c.internals.AbstractCoordinator  : [Consumer clientId=consumer-2, groupId=consumer_group] Successfully joined group with generation 25
2019-05-15 11:28:44.539  INFO 16152 --- [ment-Data-0-C-1] o.a.k.c.c.internals.ConsumerCoordinator  : [Consumer clientId=consumer-2, groupId=consumer_group] Setting newly assigned partitions [topic_x-0]
2019-05-15 11:28:44.788  INFO 16152 --- [ment-Data-0-C-1] o.s.k.l.KafkaMessageListenerContainer    : partitions assigned: [topic_x-0]
2019-05-15 11:28:45.906  INFO 16152 --- [ment-Data-0-C-1] o.a.k.c.consumer.internals.Fetcher       : [Consumer clientId=consumer-2, groupId=consumer_group] Fetch offset 5411 is out of range for partition topic_x-0, resetting offset
2019-05-15 11:28:46.187  INFO 16152 --- [ment-Data-0-C-1] o.a.k.c.consumer.internals.Fetcher       : [Consumer clientId=consumer-2, groupId=consumer_group] Resetting offset for partition topic_x-0 to offset 5651.
2019-05-15 11:28:47.864  INFO 16152 --- [ment-Data-0-C-1] o.a.k.c.c.internals.AbstractCoordinator  : [Consumer clientId=consumer-2, groupId=consumer_group] Attempt to heartbeat failed since group is rebalancing
2019-05-15 11:28:48.142  INFO 16152 --- [ment-Data-0-C-1] o.a.k.c.c.internals.ConsumerCoordinator  : [Consumer clientId=consumer-2, groupId=consumer_group] Revoking previously assigned partitions [topic_x-0]
2019-05-15 11:28:48.142  INFO 16152 --- [ment-Data-0-C-1] o.s.k.l.KafkaMessageListenerContainer    : partitions revoked: [topic_x-0]
2019-05-15 11:28:48.142  INFO 16152 --- [ment-Data-0-C-1] o.a.k.c.c.internals.AbstractCoordinator  : [Consumer clientId=consumer-2, groupId=consumer_group] (Re-)joining group
2019-05-15 11:28:48.976  INFO 16152 --- [eted-Data-0-C-1] o.a.k.c.c.internals.AbstractCoordinator  : [Consumer clientId=consumer-4, groupId=consumer_group] Successfully joined group with generation 26
2019-05-15 11:28:48.976  INFO 16152 --- [ment-Data-0-C-1] o.a.k.c.c.internals.AbstractCoordinator  : [Consumer clientId=consumer-2, groupId=consumer_group] Successfully joined group with generation 26
2019-05-15 11:28:48.976  INFO 16152 --- [ment-Data-0-C-1] o.a.k.c.c.internals.ConsumerCoordinator  : [Consumer clientId=consumer-2, groupId=consumer_group] Setting newly assigned partitions [topic_x-0]
2019-05-15 11:28:48.976  INFO 16152 --- [eted-Data-0-C-1] o.a.k.c.c.internals.ConsumerCoordinator  : [Consumer clientId=consumer-4, groupId=consumer_group] Setting newly assigned partitions [topic_y-0]
2019-05-15 11:28:49.246  INFO 16152 --- [ment-Data-0-C-1] o.s.k.l.KafkaMessageListenerContainer    : partitions assigned: [topic_x-0]
下面是我用来创建消费者的代码。组“consumerA”中的另一个使用者已在不同的应用程序中运行。当我启动“consumerB”组中的应用程序使用者时,偏移量被重置

@KafkaListener(id="client-1", topics= "topic_x", groupId = "consumerB")
    public void completed(final byte[] bytes) throws IOException {

        //Handler code

    }

你是说两个不同的消费者“consumerA”和“consumerB”,对吗?而不是消费者群体。检查两者是否不在同一消费者组中。如果这是你正在创建的唯一两个。两个不同的消费者群体。你能展示一下你是如何创建它们的吗?看起来经纪人有点问题-我只是在谷歌上搜索了一下,发现了。0.10.x.x非常古老;你真的应该升级到一个更新的代理(目前是2.2.0)。我会用新版本检查一下。谢谢@garyrussell你是说两个不同的消费者“consumerA”和“consumerB”对吗?而不是消费者群体。检查两者是否不在同一消费者组中。如果这是你正在创建的唯一两个。两个不同的消费者群体。你能展示一下你是如何创建它们的吗?看起来经纪人有点问题-我只是在谷歌上搜索了一下,发现了。0.10.x.x非常古老;你真的应该升级到一个更新的代理(目前是2.2.0)。我会用新版本检查一下。谢谢@GaryRussell