kafka Create topic 報錯

bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic kk_log
報錯如下:
WARN [Consumer clientId=consumer-1, groupId=console-consumer-507] Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)

配置server.confg時候設置的
advertised.listeners=PLAINTEXT://10.171.222.26:9092
此時需要用配置的IP而非localhost地址:

nohup bin/zookeeper-server-start.sh config/zookeeper.properties > /dev/null 2>&1 &
nohup bin/kafka-server-start.sh config/server.properties > /dev/null 2>&1 &
netstat -ntpl|egrep "(2181|9092)"
運行起來再試試
bin/kafka-console-consumer.sh --bootstrap-server 10.171.222.26:9092 --topic kk_log
應該就可以了。
做個小筆記。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章