Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to connecto do broker #1335

Open
pperesbr opened this issue Nov 13, 2024 · 2 comments
Open

Failed to connecto do broker #1335

pperesbr opened this issue Nov 13, 2024 · 2 comments

Comments

@pperesbr
Copy link

Description

Hello,

I'm trying to create a producer on a Linux Ubuntu machine to produce messages for a Kafka broker on another machine, however, when I run the program the error I see is as if the producer is trying to connect to the localhost and not the remote machine.

How to reproduce

package main

import (
	"github.com/confluentinc/confluent-kafka-go/v2/kafka"
)

func main() {

	// (1) Configuração e Criação do Produtor
	config := &kafka.ConfigMap{"bootstrap.servers": "10.200.57.34"}
	producer, err := kafka.NewProducer(config)
	if err != nil {
		panic(err)
	}
	defer producer.Close()
	// (1) FIM

	// (2) Produção da Mensagem
	topic := "test"
	msg := &kafka.Message{
		Value:          []byte("hi"),
		Key:            []byte("1"),
		TopicPartition: kafka.TopicPartition{Topic: &topic, Partition: kafka.PartitionAny},
	}

	wait := make(chan kafka.Event)
	err = producer.Produce(msg, wait)
	if err != nil {
		panic(err)
	}
	// (2) FIM

	<-wait
}

Lib C:

librdkafka-dev is already the newest version (2.3.0-1build2).

My error:

%3|1731507765.895|FAIL|rdkafka#producer-1| [thrd:localhost:9092/1]: localhost:9092/1: Connect to ipv4#127.0.0.1:9092 failed: Connection refused (after 0ms in state CONNECT)
%3|1731507766.094|FAIL|rdkafka#producer-1| [thrd:localhost:9092/1]: localhost:9092/1: Connect to ipv4#127.0.0.1:9092 failed: Connection refused (after 0ms in state CONNECT, 1 identical error(s) suppressed)

Tks

@ucanme
Copy link

ucanme commented Nov 25, 2024

i met the same question and after changing the sdk version for v2.6.0 to v2.4.0,the error disappears.

@ucanme
Copy link

ucanme commented Nov 25, 2024

i test v2.6.1, the error disappears too. i guess it's a bug of librakafka

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants