2015-07-04 69 views
3

我可以寫信給卡夫卡。然而,消費不工作用於消費的蟒蛇卡夫卡不起作用

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 
+0

看來,經紀人不可用.... – BAE

+0

python kafka客戶端的版本是什麼? doc中有一個介紹:group:該用戶的名稱,用於偏移量存儲,並且必須是唯一的 如果要連接到不支持偏移量 commit/fetch(任何在0.8.1.1之前)的服務器,則你*必須*設置爲無(從:https://github.com/mumrah/kafka-python/blob/adbd4ac052e4a5b40cfc2a3589b7adbcb656afe5/kafka/consumer/simple.py) – BAE

+0

我對卡夫卡和蟒蛇卡夫卡包裝經驗是經紀人連接是片狀的,這意味着當生產者嘗試發送消息或消費者試圖將消息標記爲消費時,可以重置連接。你最好的選擇是實施一個重試邏輯,因爲我認爲這個問題很快就會得到解決。我仍然看到他們在這裏和那裏彈出。 – adam

回答

1

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-12 15:26:32,158.158.830881119:kafka.conn:140247909795584:DEBUG:17035:重新初始化s 9092 2015-07-12 15:26:32,221.221.35591507:爲host01 OCKET連接kafka.conn:140247909795584:錯誤:17035:無法在host01連接到卡夫卡經紀人:9092