0

I am trying to setup my Kafka but I have some key issues. I can't even create a topic or send messages. My Kafka Version number is: 0.9.0.1 Thanks for your help.

Below please find my error message:

[2016-04-21 04:41:19,306] producer ERROR LEADER_NOT_AVAILABLE
Traceback (most recent call last):
  File "", line 38, in <module>
    producer.send_messages('abc.incoming_urls', json.dumps({'appid': 'channels', 'crawlid': 'category-%s' % (category), 'spiderid': 'abc', 'url': url, 'useragent': 'News/5.1.1 (iPhone; iOS 9.2; Scale/3.00)', 'attrs': {'id': category, '_': datetime.utcnow().isoformat()}}))
  File "C:\Python27\lib\site-packages\kafka\producer\simple.py", line 52, in send_messages
    partition = self._next_partition(topic)
  File "C:\Python27\lib\site-packages\kafka\producer\simple.py", line 36, in _next_partition
    self.client.load_metadata_for_topics(topic)
  File "C:\Python27\lib\site-packages\kafka\client.py", line 505, in load_metadata_for_topics
    kafka.common.check_error(topic_metadata)
  File "C:\Python27\lib\site-packages\kafka\common.py", line 255, in check_error
    raise error_class(response)
LeaderNotAvailableError: TopicMetadata(topic='abc.incoming_urls', error=5, partitions=[])
peter
  • 674
  • 1
  • 12
  • 33
  • Can you please add some more details? Like which command gives you this error? How does your Kafka cluster look like? How many brokers? Zookeeper conf? – PradeepKumbhar Apr 21 '16 at 13:05

1 Answers1

0

Be careful the advertised.host.name parameter in server.properties, which may register incorrect host name in zookeeper and block incoming connection.

< #advertised.host.name=<hostname routable by clients>
---
> advertised.host.name=xxx
Shawn Guo
  • 3,169
  • 3
  • 21
  • 28