apache kafka - BrokerNotAvailableError: Could not find the leader Exception while Spark Streaming -
i have written kafka producer in nodejs , kafka consumer in java maven. topic "test" created following command:
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
producer in nodejs:
var kafka = require('kafka-node'); var producer = kafka.producer; var client = kafka.client; var client = new client('localhost:2181'); var producer = new producer(client); producer.on('ready', function () { producer.send([ { topic: 'test', partition: 0, messages: ["this 0 message sending kafka spark"], attributes: 0}, { topic: 'test', partition: 1, messages: ["this first message sending kafka spark"], attributes: 0}, { topic: 'test', partition: 2, messages: ["this second message sending kafka spark"], attributes: 0} ], function (err, result) { console.log(err || result); process.exit(); }); });
when send 2 messages nodejs producer, consumed java consumer. when send 3 or more messages nodejs producer, gives me following error:
{ [brokernotavailableerror: not find leader] message: 'could not find leader' }
i want ask how can set leader message in topic "test". or should solution issue.
the topic created 1 partition, @ producer end trying send messages 3 partitions, logically kafka not supposed find leader other partitions , should throw exception.
Comments
Post a Comment