kafka基本设置的错误消息创建主题并发送消息

mkh04yzy  于 2021-06-07  发布在  Kafka
关注(0)|答案(1)|浏览(330)

我试图设置我的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=[])
gblwokeq

gblwokeq1#

请注意server.properties中的advised.host.name参数,这可能会在zookeeper中注册不正确的主机名并阻止传入连接。

< #advertised.host.name=<hostname routable by clients>
---
> advertised.host.name=xxx

相关问题