kafka不起作用

yr9zkbsy  于 2021-06-08  发布在  Kafka
关注(0)|答案(1)|浏览(593)

我可以给Kafka写信。然而,消费并不起作用

kafka = KafkaClient(kafka_host_list)
consumer = SimpleConsumer(kafka,'topic-test-development','topic-test-development')

No handlers could be found for logger "kafka.conn"
Traceback (most recent call last):
  File "/home/ubuntu/workspace/feed-tests/tests/kafka_consumer.py", line 44, in <module>
    consumer = SimpleConsumer(kafka,'topic-test-development','topic-test-development')
  File "/usr/local/lib/python2.7/dist-packages/kafka/consumer/simple.py", line 126, in __init__
    auto_commit_every_t=auto_commit_every_t)
  File "/usr/local/lib/python2.7/dist-packages/kafka/consumer/base.py", line 75, in __init__
    self.fetch_last_known_offsets(partitions)
  File "/usr/local/lib/python2.7/dist-packages/kafka/consumer/base.py", line 101, in fetch_last_known_offsets
    check_error(resp)
  File "/usr/local/lib/python2.7/dist-packages/kafka/common.py", line 230, in check_error
    raise response
kafka.common.FailedPayloadsError
nwnhqdif

nwnhqdif1#

注意 No handlers could be found for logger "kafka.conn" 为记录器添加代码:

logging.basicConfig(
    format='%(asctime)s.%(msecs)s:%(name)s:%(thread)d:%(levelname)s:%(process)d:%(message)s',
    level=logging.DEBUG
)

运行并输出更多信息:
2015-07-13 15:26:32158.158.830881119:Kafka。conn:140247909795584:debug:17035:为主机重新初始化套接字连接01:9092 2015-07-13 15:26:32221.221.35591507:kafka。conn:140247909795584:error:17035:无法在host01:9092连接到kafka broker

相关问题