2017-01-06 54 views
1

設置超級簡單單實例Kafka虛擬機後出現基本錯誤。這是針對小批量開發測試。Kafka 0.10.1.0測試服務器:請求元數據失敗

這是使用最新的Confluent Platform 3.1.1,它包含了幾乎最新的Kafka 0.10.1.0。僅供參考,一個稍微更新的缺陷修補程序Kafka 0.10.1.1已經出來,但下一篇文章3.1.1 Confluent Platform二進制文件包含該文件尚不可用。

我配置/etc/kafka/server.properties與(我使用的用於開發測試簡單的靜態本地IP):

listeners=PLAINTEXT://192.168.50.20:9092 
advertised.listeners=PLAINTEXT://192.168.50.20:9092 

(是嗎?)

簡單的控制檯管理命令產生的錯誤。這導致我相信基本的設置/配置有問題。

~$ /usr/bin/kafka-consumer-groups --new-consumer --bootstrap-server localhost:9092 --list 
Error while executing consumer group command Request METADATA failed on brokers List(localhost:9092 (id: -1 rack: null)) 
java.lang.RuntimeException: Request METADATA failed on brokers List(localhost:9092 (id: -1 rack: null)) 
    at kafka.admin.AdminClient.sendAnyNode(AdminClient.scala:67) 
    at kafka.admin.AdminClient.findAllBrokers(AdminClient.scala:87) 
    at kafka.admin.AdminClient.listAllGroups(AdminClient.scala:96) 
    at kafka.admin.AdminClient.listAllGroupsFlattened(AdminClient.scala:117) 
    at kafka.admin.AdminClient.listAllConsumerGroupsFlattened(AdminClient.scala:121) 
    at kafka.admin.ConsumerGroupCommand$KafkaConsumerGroupService.list(ConsumerGroupCommand.scala:304) 
    at kafka.admin.ConsumerGroupCommand$.main(ConsumerGroupCommand.scala:66) 
    at kafka.admin.ConsumerGroupCommand.main(ConsumerGroupCommand.scala) 

編輯:這個問題,感謝Gondola_Ride,是我指定的IP在listenersserver.properties。我可以通過該IP連接,但不能通過localhost。解決的辦法是使用主機0.0.0.0這是卡夫卡的慣例綁定到所有本地TCP接口:

listeners=PLAINTEXT://0.0.0.0:9092 
advertised.listeners=PLAINTEXT://192.168.50.20:9092 

回答

3

嘗試增加你在哪裏爲this主機192.168.50.20運行此命令,看到主機上的/etc/hosts一個條目,如果工作

喜歡的東西

127.0.0.1 localhost.localdomain localhost

OR

192.168.50.20 hostname hostname-alias

然後嘗試在命令中使用它

OR

嘗試直接在命令中使用ip address代替localhost

+0

哇!使用IP而不是本地主機修復它!爲什麼? – clay

+0

通過直接的'ip地址',不會有誰聯繫的困惑。但'localhost'可能會通過一些可能無法使用的映射。你有沒有檢查你的'/ etc/hosts'內容? – Confused