[英]How to connect zookeeper using sarama go client?
I am a beginner at using the sarama client.我是使用 sarama 客户端的初学者。 Although my code is working fine with the bootstrap servers but unable to connect with the zookeepers.虽然我的代码在引导服务器上运行良好,但无法连接到动物园管理员。
kafka node version: confluent-kafka-2.11-0.10.2.1-2.noarch kafka节点版本: confluent-kafka-2.11-0.10.2.1-2.noarch
sarama client version: v1.38.0 sarama客户端版本: v1.38.0
config := kafka.NewConfig()
broker := []string{"localhost:9092"}
kafkaClient, err := kafka.NewClusterAdmin(broker, config)
Error:错误:
kafka: client has run out of available brokers to talk to: EOF kafka:客户已经用完可用的经纪人来与之交谈:EOF
Your error simply says Kafka isn't running at the host:port you've provided, and has nothing to do with Zookeeper您的错误只是说Kafka没有在您提供的主机:端口上运行,并且与 Zookeeper 无关
Sarama is a Kafka client . Sarama 是Kafka 客户端。 You should not be using it to connect to Zookeeper.您不应该使用它来连接到 Zookeeper。
If you need to execute Zookeeper operations, you will need a different library, but you should never need Zookepeer operations for a Kafka application.如果您需要执行 Zookeeper 操作,您将需要一个不同的库,但您永远不需要 Kafka 应用程序的 Zookepeer 操作。 KafkaAdminClient
will forward any requests to Zookeeper, if it needs to (unless you run Kafka in Kraft mode, where Zookeeper isn't used).如果需要, KafkaAdminClient
会将任何请求转发给 Zookeeper(除非您在不使用 Zookeeper 的 Kraft 模式下运行 Kafka)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.