Kafka java Client 错误 org.apache.kafka.clients.NetworkClient Error connecting to node 1 at slave2:909

开发环境:win10+Eclipse
服务器:centos+kafka0.10.2


错误:

[2017-09-09 13:34:40,648] [DEBUG] org.apache.kafka.clients.NetworkClient Initiating connection to node 1 at slave2:9092. 
[2017-09-09 13:34:40,648] [DEBUG] org.apache.kafka.clients.NetworkClient Error connecting to node 1 at slave2:9092: 
java.io.IOException: Can't resolve address: slave2:9092
    at org.apache.kafka.common.network.Selector.connect(Selector.java:182)
    at org.apache.kafka.clients.NetworkClient.initiateConnect(NetworkClient.java:629)
    at org.apache.kafka.clients.NetworkClient.ready(NetworkClient.java:186)
    at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:184)
    at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:139)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.nio.channels.UnresolvedAddressException
    at sun.nio.ch.Net.checkAddress(Unknown Source)
    at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
    at org.apache.kafka.common.network.Selector.connect(Selector.java:179)
    ... 5 more

解决方案:
在开发环境的hosts文件中添加解析

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
192.168.17.13 slave1
192.168.17.14 slave2
192.168.17.15 slave3
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值