disconnected java.net.ConnectException: Connection refused: no further

問題:
kafka啓動正常,發送消息時報錯
Connection with /x.x.x.x:x disconnected java.net.ConnectException: Connection refused: no further information

分析:
分析個毛線,跑腳本模擬一下:
發送
消費
啊哦, 腳本沒有問題

那看來時地址設置的錯了,打開config/server.properties

#listeners=PLAINTEXT://:9092
zookeeper.connect=localhost:2181

修改如下:

listeners=PLAINTEXT://:9999
zookeeper.connect=內網ip:2181

順手改了以下三個(不需要改,我是因爲端口不是默認的)
connect-standalone.properties
consumer.properties
producer.properties

bootstrap.servers=內網ip:9999

重啓broker, 測試 ok了

解決:

server.properties中

listeners=PLAINTEXT://:你的對外端口
zookeeper.connect=你的內網ip:2181

consumer.properties/ producer.properties中

bootstrap.servers=你的內網ip:你的對外端口
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章