KafkaUnavailableError while connecting to Kafka Cluster


#1

Hi ,
I am connecting to Kafka cluster and getting following error :

kafka.errors.KafkaUnavailableError: KafkaUnavailableError: All servers failed to process request [(‘sasl_plain_username’, 9092, <AddressFamily.AF_UNSPEC: 0>), (‘bootstrap_servers’, 9092, <AddressFamily.AF_UNSPEC: 0>), (‘sasl_plain_password’, 9092, <AddressFamily.AF_UNSPEC: 0>)]

Following is the python code :
from kafka import SimpleClient , KeyedProducer , SimpleProducer
import time
broker = SimpleClient({“bootstrap_servers”:“nn02.itversity.com:2181” ,‘sasl_plain_username’:’’,‘sasl_plain_password’:’’})

file_path = ‘/home’

def dataStreamer(kafka_topic_name):

  with open(file_path+"vv") as f :
      producer = KeyedProducer(broker)
      i = 0
      while i < 100:
          for line in f :
            topic_key = line.strip()[0]

            producer.send_messages(kafka_topic_name,topic_key , line.rstrip())

            time.sleep(1)
      f.close()

dataStreamer("_data")

Does anyone have any idea what might be the issue?