Servname not supported for ai_socktype
Description
I have make a simple Async producer. But i see this error happened:
dial tcp: lookup tcp/9092}: Servname not supported for ai_socktype
I change IP or Port to anything. no matter. Every time i see that error.
My simple producer.go is here:
package producer
import (
"github.com/IBM/sarama"
"log"
)
func NewAsyncProducer(brokers []string) (sarama.AsyncProducer, error) {
config := sarama.NewConfig()
//config.Producer.Return.Successes = true
producer, err := sarama.NewAsyncProducer(brokers, config)
if err != nil {
return nil, err
}
// Create a goroutine to handle successful deliveries and errors asynchronously
go func() {
for {
select {
case success := <-producer.Successes():
log.Println(success)
case err := <-producer.Errors():
log.Println(err)
}
}
}()
return producer, nil
}
Versions
| Sarama | Kafka | Go |
|---|---|---|
| 1.41.2 | None | 1.21.1 |
Configuration
Defaults
Logs
logs: CLICK ME
dial tcp: lookup tcp/9092}: Servname not supported for ai_socktype
Additional Context
Can you share what you're supplying as brokers value? It seems the bootstrap addresses are malformed in some way. They should be a string slice of hostname:port
e.g.,
brokers := []string{
"broker-0-example.com:9093",
"broker-6-example.com:9093",
"broker-3-example.com:9093",
"broker-7-example.com:9093",
"broker-5-example.com:9093",
"broker-2-example.com:9093"
}
Thank you for taking the time to raise this issue. However, it has not had any activity on it in the past 90 days and will be closed in 30 days if no updates occur. Please check if the main branch has already resolved the issue since it was raised. If you believe the issue is still valid and you would like input from the maintainers then please comment to ask for it to be reviewed.