简体   繁体   English

无法在确切的侦听器端口上从 Kafka 分区读取数据

[英]Cannot read data from Kafka partition on exact listener port

I have Kafka cluster of 3 nodes.我有 3 个节点的 Kafka 集群。 I am using kafkacat to list data from Kafka.我正在使用kafkacat列出来自 Kafka 的数据。 I configure PLAINTEXT and VPN_PLAINTEXT listeners:我配置PLAINTEXTVPN_PLAINTEXT侦听器:

listeners=PLAINTEXT://0.0.0.0:6667,VPN_PLAINTEXT://0.0.0.0:6669
advertised.listeners=PLAINTEXT://hadoop-kafka1-stg.local.company.cloud:6667,VPN_PLAINTEXT://hadoop-kafka1-stg-vip.local.company.cloud:6669
listener.security.protocol.map=PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL,VPN_PLAINTEXT:PLAINTEXT

We find out, we cannot consume data from node 1 (only) - from topics where partition leader is node 1 with error:我们发现,我们不能(仅)使用来自节点 1 的数据——来自分区领导者是节点 1 的主题,但有错误:

kafkacat -C -b hadoop-kafka1-stg-vip.local.company.cloud:6669 -t <topic-name> -o beginning -e -q -p 11
% ERROR: Topic <topic-name> [11] error: Broker: Not leader for partition

I can see, node 1 is leader for this partition:我可以看到,节点 1 是该分区的领导者:

Metadata for <topic-name> (from broker 3: hadoop-kafka3-stg-vip.local.company.cloud:6669/3):
 3 brokers:
  broker 2 at hadoop-kafka2-stg-vip.local.company.cloud:6669
  broker 3 at hadoop-kafka3-stg-vip.local.company.cloud:6669 (controller)
  broker 1 at hadoop-kafka1-stg-vip.local.company.cloud:6669
 1 topics:
  topic "<topic-name>" with 12 partitions:
    partition 0, leader 2, replicas: 2,1,3, isrs: 3,2,1
    partition 1, leader 3, replicas: 3,2,1, isrs: 3,2,1
    partition 2, leader 1, replicas: 1,3,2, isrs: 3,2,1
    partition 3, leader 2, replicas: 2,3,1, isrs: 3,2,1
    partition 4, leader 3, replicas: 3,1,2, isrs: 3,2,1
    partition 5, leader 1, replicas: 1,2,3, isrs: 3,2,1
    partition 6, leader 2, replicas: 2,1,3, isrs: 3,2,1
    partition 7, leader 3, replicas: 3,2,1, isrs: 3,2,1
    partition 8, leader 1, replicas: 1,3,2, isrs: 3,2,1
    partition 9, leader 2, replicas: 2,3,1, isrs: 3,2,1
    partition 10, leader 3, replicas: 3,1,2, isrs: 3,2,1
    partition 11, leader 1, replicas: 1,2,3, isrs: 3,2,1

I thought the data on node could be corrupted, so I remove everything from data directory kafka_data_dir for Kafka.我认为节点上的数据可能已损坏,所以我从 Kafka 的数据目录kafka_data_dir中删除了所有内容。 When I start the daemon, I could see it syncing.当我启动守护进程时,我可以看到它正在同步。 After that, the issue persists.之后,问题仍然存在。 There is nothing suspicious in logs.日志中没有任何可疑之处。

Could anybody describ and help to find out where is the root cause?任何人都可以描述并帮助找出根本原因在哪里吗? Only node number 1 encounter this issue.只有节点号 1 遇到此问题。 When I ask the same node on port 6667 , it works smoothly.当我在端口6667上询问同一个节点时,它运行顺利。

After deeper investigation of traffic with tcpdump I find out that the Kafka configuration was without any problem.在使用 tcpdump 深入调查流量后,我发现 Kafka 配置没有任何问题。 When I asked node1 for topic partition, tcpdump on node1 did not catch any packets.当我向node1询问主题分区时, node1上的 tcpdump 没有抓到任何数据包。 Requests has been sent to node3 .请求已发送到node3 Requests should be forwarded based on DNS to the right Kafka nodes over Citrix, but the configuration was wrong:请求应该基于 DNS 通过 Citrix 转发到正确的 Kafka 节点,但配置错误:

  • hadoop-kafka1-stg-vip.local.company.cloud -> node 3 hadoop-kafka1-stg-vip.local.company.cloud -> 节点 3
  • hadoop-kafka2-stg-vip.local.company.cloud -> node 2 hadoop-kafka2-stg-vip.local.company.cloud -> 节点 2
  • hadoop-kafka3-stg-vip.local.company.cloud -> node 3 hadoop-kafka3-stg-vip.local.company.cloud -> 节点 3

That's the reason, why requests for partition where node1 is not leader works, and when asked for partition where node1 was leader failed with message Broker: Not leader for partition because it was always forwared to node3 by Citrix.这就是为什么对node1不是领导者的分区的请求有效,以及当请求node1是领导者的分区失败并显示消息Broker: Not leader for partition因为它总是被 Citrix 转发到node3的原因。

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

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