Kafka 内外部通信

编程入门 行业动态 更新时间:2024-10-26 14:33:09
本文介绍了Kafka 内外部通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

流程:本地 ------> 代理 ---> Kafka

Flow: On-Prem ------>Proxy--->Kafka

advertised.listeners=PLAINTEXT://proxyhostname:8080 - for external communication
listeners=PLAINTEXT://:9092 = for internal communication   

•当我们设置两个属性时,内部通信没有发生.(复制问题,消费者无法通过本地连接,我们必须提供消费者通信的代理IP)

•When we set both the property, the internal communication is not happening.(Replication issue and the consumer couldn’t connect via locally and we have to provide the proxy Ip for consumer communication)

•我们如何才能有效地将财产用于内部和外部沟通?

•How we can effectively use both the property for internal and external communication?

•进行外部和内部沟通的任何替代想法?

•Any alternative idea to do the external and internal communication?

推荐答案

定义多个监听器是很常见的,而 Kafka 很好地支持这一点.

It's very common to define multiple listeners and Kafka supports that very well.

要定义多个监听器,您需要在 advertised.listeners/listeners 中列出所有监听器.

To define several listeners, you need to list all of them in advertised.listeners/listeners.

如果多个侦听器要使用相同的安全协议 (PLAINTEXT),您还需要设置 listener.security.protocol.map 以将自定义名称映射到 Security协议.请参阅 Kafka 文档中的 broker 配置.

If multiple listeners are going to use the same Security Protocol (PLAINTEXT), you also need to set listener.security.protocol.map to map custom names to Security Protocols. See broker configs in the Kafka Docs.

例如:

listener.security.protocol.map=INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
advertised.listeners=INTERNAL://:9092,EXTERNAL://proxyhostname:8080
listeners=INTERNAL://:9092,EXTERNAL://:8080

这将 2 个名称 EXTERNALINTERNAL(您可以使用您喜欢的任何名称,我只是重用了您问题中的名称)到 PLAINTEXT 安全协议.然后对于每个,它定义要侦听的端口和要在元数据响应中通告的主机名.

This maps 2 names EXTERNAL and INTERNAL (you can use any name you like, I just reused names from your question) to the PLAINTEXT security protocol. Then for each, it defines the port to listen to and the hostname to advertise in metadata responses.

这篇关于Kafka 内外部通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-19 10:42:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/961753.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:通信   Kafka

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!