kavka:在连接aws-msk代理时,客户机已经没有可用的代理可以与之交谈了(您的集群可以访问吗?)

oxf4rvwz  于 2021-06-04  发布在  Kafka
关注(0)|答案(0)|浏览(276)

我正在使用sharmago客户端,在eks(amazonk8)集群上连接aws-msk,我正在使用下面的代码

config := sarama.NewConfig()
    config.Consumer.Return.Errors = true
    kafkaClient, err = sarama.NewClient(brokerAddress, config)

brokerAddress is an array of string value is [http://kafka-broker-url-1:9092, http://kafka-broker-url-2:9092]

I am getting an error 
Kafka: the client has run out of available brokers to talk to (Is your cluster reachable?)

I also tried below code snippet to connect but got the same error:

    admin, err := sarama.NewClusterAdmin(brokerAddress, config)
    if err != nil {
        KafkaLogger.Info("Error while creating cluster admin: ", err.Error())
    }

Is there any config setting which I am missing?

In the same container(to verify cluster), I tried to create a topic using Kafka script and was able to connect via zookeeper[i used a script which is present inside the bin folder,https://downloads.apache.org/kafka/2.2.2/kafka_2.11-2.2.2.tgz]

./kafka-topics.sh --create --zookeeper z-kafka.us-west-2.amazonaws.com:2181 --replication-factor 1 --partitions 1 --topic Test

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题