kafka多个消费者组的消费者去消费同一个topic,其中一个topic阻塞,是什么原因?

佐岸 发表于: 2022-08-09   最后更新时间: 2022-08-09 14:49:40   210 游览

我kafka里有多个topic,其中消费mtalog_GamePlayerRechargeEvent时,有消息阻塞,不知道是什么原因?

其中 topic 为 mtalog_GamePlayerRechargeEvent 的消费不了而且还阻塞

[root@gcp-tg-boss-kafka ~]# /data/soft/kafka/kafka_2.12-2.2.2/bin/kafka-consumer-groups.sh --describe  --bootstrap-server 172.16.88.6:9092 --group prodmate

TOPIC                               PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG             CONSUMER-ID                                                HOST            CLIENT-ID
mtalog_GamePlayerLoginRecordEvent   0          2872            2872            0               consumer-prodmate-17-84781122-c384-40ef-88c6-ab005d0d119e  /172.16.88.8    consumer-prodmate-17
mtalog_GameOnlineDurationEvent      0          1452            1452            0               consumer-prodmate-65-f96bc7fd-3e51-4d83-b04e-52f09c848338  /172.16.88.8    consumer-prodmate-65
mtalog_GameTaskMovedEvent           1          161491          161491          0               consumer-prodmate-101-9f361476-34b8-4f55-983e-32686dc611da /172.16.88.8    consumer-prodmate-101
mtalog_GameRubyChangedEvent         0          1050            1050            0               consumer-prodmate-129-39dfb106-c860-4817-ac5d-34698abbf9e6 /172.16.88.8    consumer-prodmate-129
mtalog_GamePlayerVocationEvent      1          641             641             0               consumer-prodmate-82-3d432c87-5708-4d93-a0a5-edea84ba30be  /172.16.88.8    consumer-prodmate-82
mtalog_GameOnlineAmountEvent        0          463             463             0               consumer-prodmate-49-221e5762-efbe-4262-b666-ee5c990b2afd  /172.16.88.8    consumer-prodmate-49
mtalog_GamePlayerLoginRecordEvent   1          2845            2845            0               consumer-prodmate-18-c320f230-9372-4bcb-90d8-abb211cbbd65  /172.16.88.8    consumer-prodmate-18
mtalog_GameTaskMovedEvent           0          161301          161301          0               consumer-prodmate-100-31809573-06bc-4243-a913-b6b574d95077 /172.16.88.8    consumer-prodmate-100
mtalog_GameOnlineAmountEvent        1          443             443             0               consumer-prodmate-50-609f8923-b6b7-4cc8-b442-7690120df71e  /172.16.88.8    consumer-prodmate-50
mtalog_GameLevelChangedEvent        0          52730           52730           0               consumer-prodmate-113-7e516031-712d-4e10-a4ed-ddf626fca51c /172.16.88.8    consumer-prodmate-113
mtalog_GameShopPropertyChangedEvent 1          642             642             0               consumer-prodmate-146-0786d6aa-f40d-48b8-bc48-59642a4c5068 /172.16.88.8    consumer-prodmate-146
mtalog_GameShopPropertyChangedEvent 0          668             668             0               consumer-prodmate-145-ad67db6c-f44e-4c15-b0ad-3a8fb31aba34 /172.16.88.8    consumer-prodmate-145
mtalog_GamePlayerRechargeEvent      0          137             188             51              consumer-prodmate-33-d72d2a87-442c-41a3-a249-0c4b5f69b3c6  /172.16.88.8    consumer-prodmate-33
mtalog_GameCreateRoleEvent          0          702             702             0               consumer-prodmate-1-3e9a58c1-e747-4b4d-84a8-efd29f663e43   /172.16.88.8    consumer-prodmate-1
mtalog_GamePlayerVocationEvent      0          666             666             0               consumer-prodmate-81-1f15eb33-c0b3-4366-98e2-d3f5987b5e39  /172.16.88.8    consumer-prodmate-81
mtalog_GameOnlineDurationEvent      1          1440            1440            0               consumer-prodmate-66-9f55e6a5-1bbc-46cf-ab16-1a4d3938fb0e  /172.16.88.8    consumer-prodmate-66
mtalog_GameRubyChangedEvent         1          1027            1027            0               consumer-prodmate-130-ebc3fbfa-d976-4dbd-87cb-853fa39c56bb /172.16.88.8    consumer-prodmate-130
mtalog_GameLevelChangedEvent        1          52652           52652           0               consumer-prodmate-114-854a97f9-d266-4079-8c37-94349284773b /172.16.88.8    consumer-prodmate-114
mtalog_GamePlayerRechargeEvent      1          -               184             -               consumer-prodmate-34-5cf7c0c3-d464-4697-90dc-5db1d95cc024  /172.16.88.8    consumer-prodmate-34
mtalog_GameCreateRoleEvent          1          605             605             0               consumer-prodmate-10-cfced4a5-b584-473f-b8fd-fd8dc488c9a7  /172.16.88.8    consumer-prodmate-10
[root@gcp-tg-boss-kafka ~]# /data/soft/kafka/kafka_2.12-2.2.2/bin/kafka-consumer-groups.sh --describe  --bootstrap-server 172.16.88.6:9092 --group local1

TOPIC                             PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG             CONSUMER-ID                                              HOST            CLIENT-ID
mtalog_GameOnlineAmountEvent      1          443             443             0               consumer-local1-50-3c1b99bc-dbbb-41ba-8d7a-f332114a6215  /172.19.0.3     consumer-local1-50
mtalog_GamePlayerRechargeEvent    0          137             188             51              consumer-local1-33-0fc53f5c-9709-4794-a5d1-3e10ce8e80fc  /172.19.0.3     consumer-local1-33
mtalog_GamePropertyChangedEvent   0          375212          375212          0               consumer-local1-100-1fe24cab-f359-4454-9766-96bf493a44f5 /172.19.0.3     consumer-local1-100
mtalog_GameLevelChangedEvent      0          52655           52655           0               consumer-local1-113-32dcca26-d05c-4454-be5c-837b142dab35 /172.19.0.3     consumer-local1-113
mtalog_GamePlayerRechargeEvent    1          -               184             -               consumer-local1-34-d710809a-da37-42ed-a447-a09df3679a6a  /172.19.0.3     consumer-local1-34
mtalog_GameMoneyChangedEvent      0          243757          243757          0               consumer-local1-81-141872f5-5099-4eea-aa5e-1910ca5f619c  /172.19.0.3     consumer-local1-81
mtalog_GameOnlineAmountEvent      0          463             463             0               consumer-local1-49-f09c2f54-5557-4f04-96b1-669c092441e0  /172.19.0.3     consumer-local1-49
mtalog_GamePlayerLoginRecordEvent 0          2867            2867            0               consumer-local1-17-bef77854-ba6c-4368-9a0d-710899697470  /172.19.0.3     consumer-local1-17
mtalog_GamePropertyChangedEvent   1          376029          376029          0               consumer-local1-101-fe8bfb96-176a-436e-bb75-588284c80441 /172.19.0.3     consumer-local1-101
mtalog_GameCreateRoleEvent        0          702             702             0               consumer-local1-1-083f0591-d871-4dc4-8215-33a62d5ae268   /172.19.0.3     consumer-local1-1
mtalog_GamePlayerLoginRecordEvent 1          2842            2842            0               consumer-local1-18-a1ffc3e5-09a4-472f-8b87-be49a1c71d60  /172.19.0.3     consumer-local1-18
mtalog_GameCreateRoleEvent        1          605             605             0               consumer-local1-10-73dad468-8116-4164-9140-5ae6bf06d719  /172.19.0.3     consumer-local1-10
mtalog_GameOnlineDurationEvent    0          1452            1452            0               consumer-local1-65-0a6867fa-331c-419c-b906-ac92751ee9ea  /172.19.0.3     consumer-local1-65
mtalog_GameLevelChangedEvent      1          52600           52600           0               consumer-local1-114-1d5a4035-fbac-4972-9920-acc1a435cf91 /172.19.0.3     consumer-local1-114
mtalog_GameMoneyChangedEvent      1          243826          243826          0               consumer-local1-82-1fb55c59-2a76-429f-9f20-668578fcf50f  /172.19.0.3     consumer-local1-82
mtalog_GameOnlineDurationEvent    1          1440            1440            0               consumer-local1-66-06fcf1d3-df9b-498f-9b6d-83cd4ef29e42  /172.19.0.3     consumer-local1-66
发表于 2022-08-09

你这个topic是有问题了,你查下该topic的情况:

bin/kafka-topics.sh --bootstrap-server localhost:9092 --topic mtalog_GamePlayerRechargeEvent --describe

佐岸 -> 半兽人 1月前
Error while executing topic command : org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment.
[2022-08-09 14:46:20,879] ERROR java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment.
    at org.apache.kafka.common.internals.KafkaFutureImpl.wrapAndThrow(KafkaFutureImpl.java:45)
    at org.apache.kafka.common.internals.KafkaFutureImpl.access$000(KafkaFutureImpl.java:32)
    at org.apache.kafka.common.internals.KafkaFutureImpl$SingleWaiter.await(KafkaFutureImpl.java:89)
    at org.apache.kafka.common.internals.KafkaFutureImpl.get(KafkaFutureImpl.java:260)
    at kafka.admin.TopicCommand$AdminClientTopicService.getTopics(TopicCommand.scala:254)
    at kafka.admin.TopicCommand$AdminClientTopicService.describeTopic(TopicCommand.scala:204)
    at kafka.admin.TopicCommand$.main(TopicCommand.scala:66)
    at kafka.admin.TopicCommand.main(TopicCommand.scala)
Caused by: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment.
 (kafka.admin.TopicCommand$)

这个问题查到了,但是没法解决,目前把kafka重新安装同时把topic重新创建了 还是不行

半兽人 -> 佐岸 1月前

timeout,网络问题,可以参考相关问题解决:kafka 远程配置报 Timed out waiting for a node assignment.

佐岸 -> 半兽人 1月前

针对这个log,我入到mysql里时一个索引的问题,我把订单ID设置成唯一键,但是log的订单ID有重复的,导致入库报错,消费慢了 ,就导致消费阻塞。正常这个订单ID是不重复的。总结下来就是消费者报错导致的

你的答案

查看kafka相关的其他问题或提一个您自己的问题
提问