我在EC2实例上部署了kafka集群,ip a.b.c.d
,生产者和使用者也部署在{{1}上ip a2.b2.c2.d2
的另一个EC2实例(在同一个实例上)上{{1} catalina.out
机器的日志文件我总是对错误进行罚款
producer/consumer
指出java.net.UnknownHostException: ip-a2-b2-c2-d2: ip-a2-b2-c2-d2: Name or service not known
at java.net.InetAddress.getLocalHost(InetAddress.java:1496)
at kafka.consumer.ZookeeperConsumerConnector.<init>(ZookeeperConsumerConnector.scala:107)
at kafka.consumer.ZookeeperConsumerConnector.<init>(ZookeeperConsumerConnector.scala:128)
at kafka.consumer.Consumer$.create(ConsumerConnector.scala:89)
at kafka.consumer.Consumer.create(ConsumerConnector.scala)
at com.wsg.promo.kafka.listener.ConsumerClient.run(ConsumerClient.java:90)
at com.wsg.promo.kafka.listener.ConsumerClient.run(ConsumerClient.java:62)
Caused by: java.net.UnknownHostException: ip-a2-b2-c2-d2: Name or service not known
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:922)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1316)
at java.net.InetAddress.getLocalHost(InetAddress.java:1492)
... 6 more
计算机尝试连接到自身(producer/consumer
用于ip-a2-b2-c2-d2
计算机),
为什么producer/consumer
机器试图连接到自己? (这是正常的吗?)我该如何解决这个问题?我已经花了大约16个小时。弄清楚,但没有运气