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

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

问题描述

我在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
  • 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创建了路由.在两种情况下,当我提供路由值时(例如示例中的my-cluster-myproject.192.168.99.100.nip.io:9092

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/#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连接Strimzi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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