0

我正在尝试设置我的 Kafka,但我有一些关键问题。我什至无法创建主题或发送消息。我的 Kafka 版本号是:0.9.0.1 感谢您的帮助。

请在下面找到我的错误消息:

[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=[])
4

1 回答 1

0

注意 server.properties 中的Advertisementd.host.name参数,它可能会在 zookeeper 中注册错误的主机名并阻止传入连接。

< #advertised.host.name=<hostname routable by clients>
---
> advertised.host.name=xxx
于 2016-04-27T13:45:52.077 回答