简体   繁体   English

Kafka节点仅适用于Zookeeper端口(2181)

[英]Kafka-node only works on Zookeeper port (2181)

When I try to make a new KafkaClient I must specify the IP of my node and the port 2181 on Node.js. 当我尝试制作新的KafkaClient ,必须指定节点的IP和Node.js上的端口2181。

I am making heavy inserts into my DB through Kafka and everytime I leave it run overnight I get CONNECTION_LOSS[-4] errors which must have to do with Zookeeper. 我正在通过Kafka向数据库中插入大量内容,每次让它运行过夜时,都会出现CONNECTION_LOSS[-4]错误,这与Zookeeper有关。

On other languages the Kafka port 9092 works for producing/consuming, just not on Node.js . 在其他语言上,Kafka端口9092可用于生产/消费,而不是在Node.js

How can I fix this issue and avoid these connection errors, and use port 9092 rather than 2181? 如何解决此问题并避免这些连接错误,并使用端口9092而不是2181?

What version of Kafka are you using ? 您正在使用什么版本的Kafka?

Prior to 0.9.0 the connection to Zookeeper from a consumer was needed because the consumer used Zookeeper for saving offsets. 在0.9.0之前,需要从使用者到Zookeeper的连接,因为使用者使用Zookeeper来保存偏移量。

Starting from 0.9.0 , the offsets are saved in a specific topic named __consumer_offsets and for this reason the only connection the client needs is to Kafka brokers (the bootstrap ones) on the port 9092 you are talking about. 0.9.0开始,偏移量保存在名为__consumer_offsets的特定主题中,因此,客户端唯一需要的连接是您正在谈论的端口9092上的Kafka代理(引导程序)。

In any case remember that Kafka needs connection on Zookeeper on port 2181 for doing all the other stuff (controller election, topic information and so on). 无论如何,请记住,Kafka需要在端口2181上的Zookeeper上进行连接,以执行所有其他操作(控制器选举,主题信息等)。

It's not about using port 9092 instead of 2181 . 这与使用端口9092而不是2181无关。

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

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