kcat 无法连接到代理。

huangapple go评论54阅读模式
英文:

kcat fials to connect to broker

问题

I've been trying to consume messages from broker using kcat, however for some reasons kcat tries to connect to localhost:9092 instead of the broker I've supplied to it using the -b switch.

An example :

kcat -C -b -t test-topic1 -o -1 -e
%3|1675853772.320|FAIL|rdkafka#consumer-1| [thrd:localhost:9092/1001]: localhost:9092/1001: Connect to ipv4#127.0.0.1:9092 failed: Connection refused (after 0ms in state CONNECT)
% ERROR: Local: Broker transport failure: localhost:9092/1001: Connect to ipv4#127.0.0.1:9092 failed: Connection refused (after 0ms in state CONNECT)
%3|1675853772.576|FAIL|rdkafka#consumer-1| [thrd:localhost:9092/1001]: localhost:9092/1001: Connect to ipv6#[::1]:9092 failed: Connection refused (after 0ms in state CONNECT)
% ERROR: Local: Broker transport failure: localhost:9092/1001: Connect to ipv6#[::1]:9092 failed: Connection refused (after 0ms in state CONNECT)

I think I'm missing something obvious here, but why does it want to connect to localhost?
If I issue a command like

kcat -b -L
it works like a charm and lists topics and partitions from the broker

英文:

I've been trying to consume messages from broker using kcat, however for some reasons kcat tries to connect to localhost:9092 instead of the broker I've supplied to it using the -b switch.
I've been through all the official documentation and several how-to's but i can not figure this one out.

An example :

kcat -C -b <remote kafka broker ip> -t test-topic1 -o -1 -e
%3|1675853772.320|FAIL|rdkafka#consumer-1| [thrd:localhost:9092/1001]: localhost:9092/1001: Connect to ipv4#127.0.0.1:9092 failed: Connection refused (after 0ms in state CONNECT)
% ERROR: Local: Broker transport failure: localhost:9092/1001: Connect to ipv4#127.0.0.1:9092 failed: Connection refused (after 0ms in state CONNECT)
%3|1675853772.576|FAIL|rdkafka#consumer-1| [thrd:localhost:9092/1001]: localhost:9092/1001: Connect to ipv6#[::1]:9092 failed: Connection refused (after 0ms in state CONNECT)
% ERROR: Local: Broker transport failure: localhost:9092/1001: Connect to ipv6#[::1]:9092 failed: Connection refused (after 0ms in state CONNECT)

I think i'm missing something obvious here, but why does it want to connect to localhost?
If i issue a command like

kcat -b <remote kafka broker ip> -L

it works like a charm and lists topics and partitions from the <remote kafka broker ip>
broker

答案1

得分: 1

你是否仔细检查了你的kcat配置?如果你没有明确提供你的代理,它可能会从那里读取。

这里有一篇博客文章,介绍如何设置你的配置。如果你按照这种方式设置,每次运行它时都不必传入 -b 标志。

英文:

Have you double-checked your kcat configuration? It might be reading from that if you're not providing your broker explicitly.

Here's a blog post on how to set up your config. If you set it up that way, you don't have to pass in your -b flag every time you run it, either.

答案2

得分: 1

因为这是 Kafka 的 server.properties 中在 advertised.listeners 下列出的内容。

https://www.confluent.io/blog/kafka-listeners-explained/

英文:

> why does it want to connect to localhost

Because that is what Kafka's server.properties has listed under advertised.listeners.

https://www.confluent.io/blog/kafka-listeners-explained/

答案3

得分: 0

感谢您所有的回答!最后意识到错误是在我的一方,我选择了一个正确配置的Kafka Docker镜像。一切都很顺利。

英文:

Thanks for all your answers!
In the end realizing that the error was on my side, i went with a properly configured kafka docker image. Worked right out of the box

huangapple
  • 本文由 发表于 2023年2月8日 19:07:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/75384885.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定