kafka无法在ubuntu示例上启动,getlocalhost(inetaddress)返回ip,并在ip开头附加“ip”

zsbz8rwp  于 2021-06-08  发布在  Kafka
关注(0)|答案(1)|浏览(336)

在aws上运行ubuntu。当我尝试启动Kafka时,我看到了一个例外:

[2018-07-22 06:18:44,467] ERROR [KafkaServer id=0] Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
java.net.UnknownHostException: ip-10-153-166-139: ip-10-153-166-139: Name or service not known
    at java.net.InetAddress.getLocalHost(InetAddress.java:1505)
    at kafka.server.KafkaServer$$anonfun$3.apply(KafkaServer.scala:390)
    at kafka.server.KafkaServer$$anonfun$3.apply(KafkaServer.scala:388)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
    at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
    at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
    at scala.collection.AbstractTraversable.map(Traversable.scala:104)
    at kafka.server.KafkaServer.createBrokerInfo(KafkaServer.scala:388)
    at kafka.server.KafkaServer.startup(KafkaServer.scala:256)
    at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:38)
    at kafka.Kafka$.main(Kafka.scala:75)
    at kafka.Kafka.main(Kafka.scala)
Caused by: java.net.UnknownHostException: ip-10-153-166-139: Name or service not known
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
    at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
    at java.net.InetAddress.getLocalHost(InetAddress.java:1500)
    ... 13 more
[2018-07-22 06:18:44,469] INFO [KafkaServer id=0] shutting down (kafka.server.KafkaServer)

从我开始使用这张图片开始,我就注意到了这一点:

ubuntu@ip-10-153-166-139:

为什么kafka服务器试图使用“ip”来完全启动示例ip?是否有一个系统配置我可以更改,以便只由getlocalhost返回ip本身?

bq9c1y66

bq9c1y661#

如上所述,答案如下:
为什么我不能从外面联系到Kafka?
inside/kafka/config/server.properties添加:
host.name='actual.ip.of.box'

相关问题