简体   繁体   English

卡夫卡复制问题

[英]Kafka replication issue

I am using a 3 broker kafka.我正在使用 3 经纪人卡夫卡。 If I stop the third node: no problem, I can consume LOGS from node 1 or 2. If I stop the second node: no problem, I can consume LOGS from node 1 or 3. If I stop the first node: I am not able to consume anything.如果我停止第三个节点:没问题,我可以从节点 1 或 2 消费日志。如果我停止第二个节点:没问题,我可以从节点 1 或 3 消费日志。如果我停止第一个节点:我不是能够消耗任何东西。

When I restart kafka-runner service.当我重新启动 kafka-runner 服务时。 Logs are here and was wrote properly.日志在这里并且写得正确。

my topic configuration is: Topic: log_topic TopicId: xxx PartitionCount: 32 ReplicationFactor: 3 Configs: segment.bytes=1073741824,retention.ms=7200000 Topic: log_topic Partition: 0 Leader: 2 Replicas: 1,2,3 Isr: 2,3,1 Topic: log_topic Partition: 1 Leader: 2 Replicas: 1,2,3 Isr: 2,3,1 Topic: log_topic Partition: 2 Leader: 2 Replicas: 1,2,3 Isr: 2,3,1 Topic: log_topic Partition: 3 Leader: 2 Replicas: 1,2,3 Isr: 2,3,1 Topic: log_topic Partition: 4 Leader: 2 Replicas: 1,2,3 Isr: 2,3,1 Topic: log_topic Partition: 5 Leader: 2 Replicas: 1,2,3 Isr: 2,3,1 Topic: log_topic Partition: 6 Leader: 2 Replicas: 1,2,3 Isr: 2,3,1 Topic: log_topic Partition: 7 Leader: 2 Replicas: 1,2,3 Isr: 2,3,1 Topic: log_topic Partition: 8 Leader: 2 Replicas: 1,2,3 Isr: 2,3,1 Topic: log_topic Partition: 9 Leader: 2 Replicas: 1,2,3 Isr: 2,3,1 Topic: log_topic Partition: 10 Leader: 2 Replicas: 2,3,1 Isr: 2,3,1 Topic: log_topic Partition: 11 Leader: 3 Replicas: 3,1,2 Isr: 2,3,1 Topic: log_topic Partition: 12 Leader: 3 R我的主题配置是: Topic: log_topic TopicId: xxx PartitionCount: 32 ReplicationFactor: 3 Configs: segment.bytes=1073741824,retention.ms=7200000 Topic: log_topic Partition: 0 Leader: 2 Replicas: 1,2,3 Isr: 2, 3,1 主题:log_topic 分区:1 领导者:2 副本:1,2,3 Isr:2,3,1 主题:log_topic 分区:2 领导者:2 副本:1,2,3 Isr:2,3,1 主题:log_topic 分区:3 领导者:2 副本:1,2,3 Isr:2,3,1 主题:log_topic 分区:4 领导者:2 副本:1,2,3 Isr:2,3,1 主题:log_topic 分区: 5 领导者:2 副本:1,2,3 Isr:2,3,1 主题:log_topic 分区:6 领导者:2 副本:1,2,3 Isr:2,3,1 主题:log_topic 分区:7 领导者:2副本:1,2,3 Isr:2,3,1 主题:log_topic 分区:8 领导者:2 副本:1,2,3 Isr:2,3,1 主题:log_topic 分区:9 领导者:2 副本:1, 2,3 Isr:2,3,1 主题:log_topic 分区:10 领导者:2 副本:2,3,1 Isr:2,3,1 主题:log_topic 分区:11 领导者:3 副本:3,1,2 Isr :2,3,1 主题:log_topic 分区:12 领导者:3 R eplicas: 1,3,2 Isr: 2,3,1 Topic: log_topic Partition: 13 Leader: 2 Replicas: 2,1,3 Isr: 2,3,1 Topic: log_topic Partition: 14 Leader: 3 Replicas: 3,2,1 Isr: 2,3,1 Topic: log_topic Partition: 15 Leader: 2 Replicas: 1,2,3 Isr: 2,3,1 Topic: log_topic Partition: 16 Leader: 2 Replicas: 2,3,1 Isr: 2,3,1 Topic: log_topic Partition: 17 Leader: 3 Replicas: 3,1,2 Isr: 2,3,1 Topic: log_topic Partition: 18 Leader: 3 Replicas: 1,3,2 Isr: 2,3,1 Topic: log_topic Partition: 19 Leader: 2 Replicas: 2,1,3 Isr: 2,3,1 Topic: log_topic Partition: 20 Leader: 3 Replicas: 3,2,1 Isr: 2,3,1 Topic: log_topic Partition: 21 Leader: 2 Replicas: 1,2,3 Isr: 2,3,1 Topic: log_topic Partition: 22 Leader: 2 Replicas: 2,3,1 Isr: 2,3,1 Topic: log_topic Partition: 23 Leader: 3 Replicas: 3,1,2 Isr: 2,3,1 Topic: log_topic Partition: 24 Leader: 3 Replicas: 1,3,2 Isr: 2,3,1 Topic: log_topic Partition: 25 Leader: 2 Replicas: 2,1,3 Isr: 2,3,1 Topic: log_topic Partition: 26 Leader: 3 Replicas: 3,2,1 Isr: 2,3,1 Topic: log_topic Parti副本:1,3,2 Isr:2,3,1 主题:log_topic 分区:13 领导者:2 副本:2,1,3 Isr:2,3,1 主题:log_topic 分区:14 领导者:3 副本:3, 2,1 Isr:2,3,1 主题:log_topic 分区:15 领导者:2 副本:1,2,3 Isr:2,3,1 主题:log_topic 分区:16 领导者:2 副本:2,3,1 Isr :2,3,1 主题:log_topic 分区:17 领导者:3 副本:3,1,2 Isr:2,3,1 主题:log_topic 分区:18 领导者:3 副本:1,3,2 Isr:2,3 ,1 主题:log_topic 分区:19 领导者:2 副本:2,1,3 Isr:2,3,1 主题:log_topic 分区:20 领导者:3 副本:3,2,1 Isr:2,3,1 主题: log_topic 分区:21 领导者:2 副本:1,2,3 Isr:2,3,1 主题:log_topic 分区:22 领导者:2 副本:2,3,1 Isr:2,3,1 主题:log_topic 分区:23领导者:3 副本:3,1,2 Isr:2,3,1 主题:log_topic 分区:24 领导者:3 副本:1,3,2 Isr:2,3,1 主题:log_topic 分区:25 领导者:2 副本: 2,1,3 Isr: 2,3,1 Topic: log_topic Partition: 26 Leader: 3 Replicas: 3,2,1 Isr: 2,3,1 Topic: log_topic Parti tion: 27 Leader: 2 Replicas: 1,2,3 Isr: 2,3,1 Topic: log_topic Partition: 28 Leader: 2 Replicas: 2,3,1 Isr: 2,3,1 Topic: log_topic Partition: 29 Leader: 3 Replicas: 3,1,2 Isr: 2,3,1 Topic: log_topic Partition: 30 Leader: 3 Replicas: 1,3,2 Isr: 2,3,1 Topic: log_topic Partition: 31 Leader: 2 Replicas: 2,1,3 Isr: 2,3,1 tion: 27 Leader: 2 Replicas: 1,2,3 Isr: 2,3,1 Topic: log_topic Partition: 28 Leader: 2 Replicas: 2,3,1 Isr: 2,3,1 Topic: log_topic Partition: 29 Leader :3 副本:3,1,2 Isr:2,3,1 主题:log_topic 分区:30 领导者:3 副本:1,3,2 Isr:2,3,1 主题:log_topic 分区:31 领导者:2 副本: 2,1,3 ISR:2,3,1

When I stop leader node.当我停止领导节点时。 leader changes properly.领导者适当改变。

Any Idea?任何的想法?

Make sure your __consumer_offsets topic has three replicas and is not only hosted on broker 1. By default it only has 1 replica, as established in server.properties确保您的__consumer_offsets主题具有三个副本,并且不仅托管在代理 1 上。默认情况下,它只有 1 个副本,如server.properties中所述

This seems like a configuration issue with the __consumer_offsets topic.这似乎是__consumer_offsets主题的配置问题。

_consumer_offsets is used to store information about committed offsets for each topic:partition per group of consumers (groupID) _consumer_offsets 用于存储有关每个主题的已提交偏移量的信息:每组消费者的分区(groupID)

Whenever a consumer in a group reads data from kafka, it periodically stores the information on the point till the data is read in a special topic called __consumer_offsets.每当一个组中的消费者从kafka中读取数据时,它会定期将信息存储在该点上,直到数据被读取到一个名为__consumer_offsets的特殊主题中。 This is done so that the consumer can resume from its last position in case of failure.这样做是为了在发生故障时消费者可以从其最后的 position 恢复。

Issue问题

The replication factor for __consumer_offsets topic would have been set to 1 and all the partitions for the topic would also be present in broker 1. __consumer_offsets 主题的复制因子将设置为 1,并且该主题的所有分区也将出现在代理 1 中。

You can describe the __consumer_offsets topic to verify above.您可以描述 __consumer_offsets 主题以在上面进行验证。 If this is the case, then the easiest way to resolve the issue would be to delete the __consumer_offsets topic and recreate it with the desired replication factor.如果是这种情况,那么解决该问题的最简单方法是删除 __consumer_offsets 主题并使用所需的复制因子重新创建它。

If deletion is not an option, then following the instructions in the thread below如果删除不是一个选项,则按照下面线程中的说明进行操作

How to change the number of replicas of a Kafka topic? 如何更改 Kafka 主题的副本数?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM