OpenShift - 无法从 KafkaJS 连接 Stramzi [英] OpenShift - Unable to connect Strimzi from KafkaJS

查看:24
本文介绍了OpenShift - 无法从 KafkaJS 连接 Stramzi的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 OpenShift 上成功设置了 Strimzi Kafka 集群.我可以看到以下服务:

I have Strimzi Kafka cluster set-up successfully on OpenShift. I can see the following services:

  • kafka-brokers
  • kafka-bootstrap
  • zookeeper-client
  • zookeeper-nodes

这实际上与这里所说的不同;所以,不确定这是否是Strimzi 安装问题.我按照此处中的安装步骤进行操作.

This is actually different from what is called out here; so, not sure, if this is a Strimzi installation issue. I followed installation steps from here.

我在端口 9092(非 TLS 客户端)上为 kafka-bootstrapkafka-brokers 创建了一个路由.在这两种情况下,当我提供路由值时,我都会收到 ECONNREFUSED 错误(例如 my-cluster-myproject.192.168.99.100.nip.io:9092 在示例中来自kafkajs.

I created a routes for kafka-bootstrap and kafka-brokers on port 9092 (non-TLS clients). In both cases, I get a ECONNREFUSED error when I provide the route value (e.g. my-cluster-myproject.192.168.99.100.nip.io:9092 in the example from kafkajs.

如何将kafkajs包连接到Strimzi集群?

How do I get the kafkajs package connected to the Strimzi cluster?

推荐答案

您看到的 Strimzi 服务是正确的,但为了访问 Kafka 代理,最好使用仅允许指定一个代理"的引导服务在您客户端的引导服务器列表中,它将选择一个代理进行第一次连接,然后获取元数据(它避免了您使用无头服务进行连接,其中 pod IP 可以在重新启动时更改).也就是说,如果您需要从 OpenShift 外部访问代理,则不必手动为引导服务创建路由,但必须配置外部侦听器(https://strimzi.io/docs/latest/#assembly-configuring-kafka-broker-listeners-deployment-configuration-kafka) 类型为 route.如上所述,OpenShift 路由仅适用于 TCP 连接的 TLS.为了向您的客户提供用于 TLS 的正确证书,您可以按照文档的这一部分进行操作:https://strimzi.io/docs/latest/#kafka_client_connections

The Strimzi services that you are seeing are correct but in order to access the Kafka brokers, it's better using the bootstrap service which allows to specify only one "broker" in the bootstrap servers list of your client and it will select a broker to connect the first time and then getting metadata (it avoids to you to connect using the headless service where the pod IPs can change on restart). So saying that, if you need to access the brokers from outside of OpenShift you don't have to create a route for the bootstrap service manually but you have to configure external listeners (https://strimzi.io/docs/latest/#assembly-configuring-kafka-broker-listeners-deployment-configuration-kafka) with type route. As already mentioned above, the OpenShift routes work with TLS only for TCP connections. In order to provide your clients the right certificate tu use for TLS you can follow this part of the documentation: https://strimzi.io/docs/latest/#kafka_client_connections

这篇关于OpenShift - 无法从 KafkaJS 连接 Stramzi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆