Kafka Stream消费者组未显示偏移

时间:2018-09-28 07:48:36

标签: apache-kafka kafka-consumer-api apache-kafka-streams

我有两个kafka stream应用程序。

我可以看到使用此功能的消费群体

>bin/kafka-consumer-groups.sh  --list --bootstrap-server localhost:9092`
streams-distribution-app
streams-collection-app

我可以使用以下方式查看发行版应用的偏移量:

>bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group streams-distribution-app
TOPIC                    PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG             CONSUMER-ID                             HOST            CLIENT-ID
o365_user_activity       0          3900            3985            85              streams-distribution-app-StreamThread-1 /127.0.0.1      
o365_cassandra_data_load 0          -               0               -               streams-distribution-app-StreamThread-1 /127.0.0.1      streams-distribution-app

但是我无法查看collection-app的偏移量:

bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group streams-collection-app 
Note: This will not show information about old Zookeeper-based consumers.

该应用程序正在运行并正在处理日志。我不明白为什么不描述偏移信息。

更新:

一段时间(大约20分钟)后,我终于可以看到偏移量了。 但是有很多滞后。

bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group streams-collection-app 
Note: This will not show information about old Zookeeper-based consumers.

TOPIC                    PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG     CONSUMER-ID                             HOST        CLIENT-ID
o365_activity_contenturl 0          200             64941           64741   streams-collection-app-StreamThread-1   /127.0.0.1 streams-collection-app

这些是stream-collection-app的配置:

props.put(StreamsConfig.producerPrefix(ProducerConfig.RETRIES_CONFIG), Integer.MAX_VALUE);
props.put(StreamsConfig.producerPrefix(ProducerConfig.RETRY_BACKOFF_MS_CONFIG), Integer.MAX_VALUE);
props.put(StreamsConfig.producerPrefix(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG), Integer.MAX_VALUE);
props.put(StreamsConfig.consumerPrefix(ConsumerConfig.MAX_POLL_RECORDS_CONFIG), 200);

更新2:

我尝试增加num.stream.threads的配置并将其设置为4。然后重新启动应用程序,其中包含有关源主题的40k多个记录。

仍然没有描述流应用使用者组的输出。大约10-15分钟后,我可以看到以下偏移量:

bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group streams-collection-app
Note: This will not show information about old Zookeeper-based consumers.

TOPIC                    PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG    CONSUMER-ID                            HOST            CLIENT-ID
o365_activity_contenturl 0          200             11274           11074  streams-collection-app-StreamThread-1  /127.0.0.1      streams-app-StreamThread-1
o365_activity_contenturl 1          200             11384           11184  streams-collection-app-StreamThread-2  /127.0.0.1      streams-app-StreamThread-2
o365_activity_contenturl 3          200             11343           11143  streams-collection-app-StreamThread-4  /127.0.0.1      streams-app-StreamThread-4
o365_activity_contenturl 2          200             11471           11271  streams-collection-app-StreamThread-3  /127.0.0.1      streams-app-StreamThread-3

0 个答案:

没有答案