Modernmt: Kafka error due to unknown host name

Created on 4 Oct 2017  路  3Comments  路  Source: modernmt/modernmt

I've copied a working install to a new machine. Having fixed few config troubles, I now get this one : a Kafka module seems to use the machine name, and complains about the fact it is unknown.

Of course, there certainly may be a solution in the config of my local network. But, is there a solution in MMT just to avoid this ? Why isn't it simply using the machine's IP address ?

[2017-10-04 10:53:40,427] FATAL Fatal error during KafkaServerStartable startup. Prepare to shutdown (kafka.server.KafkaServerStartable) java.net.UnknownHostException: lm-dev7-Desktop: lm-dev7-Desktop: Name or service not known at java.net.InetAddress.getLocalHost(InetAddress.java:1505) at kafka.server.KafkaHealthcheck.$anonfun$register$1(KafkaHealthcheck.scala:61) at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:234) at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:59) at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:52) at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48) at scala.collection.TraversableLike.map(TraversableLike.scala:234) at scala.collection.TraversableLike.map$(TraversableLike.scala:227) at scala.collection.AbstractTraversable.map(Traversable.scala:104) at kafka.server.KafkaHealthcheck.register(KafkaHealthcheck.scala:59) at kafka.server.KafkaHealthcheck.startup(KafkaHealthcheck.scala:51) at kafka.server.KafkaServer.startup(KafkaServer.scala:269) at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:39) at kafka.Kafka$.main(Kafka.scala:67) at kafka.Kafka.main(Kafka.scala) Caused by: java.net.UnknownHostException: lm-dev7-Desktop: 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) ... 14 more [2017-10-04 10:53:40,428] INFO [Kafka Server 0], shutting down (kafka.server.KafkaServer)

Most helpful comment

Thanks for your reply. I just found the solution by myself at the same time..

On this machine, hostname command is returning lm-dev7-Desktop, while the /etc/hosts contains lmdev7-Desktop (lack of a "-"). Changing it to match the hostname solved the problem.

;-)

All 3 comments

Hi @EtienneAb3d ,
Kafka uses Hostnames instead of IPs internally because, I suppose, in this way it always resolve to the correct IP, even if it changes during time.

I think this fix will work for you - just add a line to /etc/hosts (you need sudo permissions):

127.0.0.1    lm-dev7-Desktop

Let me know if this solves you problem!

Thanks for your reply. I just found the solution by myself at the same time..

On this machine, hostname command is returning lm-dev7-Desktop, while the /etc/hosts contains lmdev7-Desktop (lack of a "-"). Changing it to match the hostname solved the problem.

;-)

Hi @EtienneAb3d ,
Kafka uses Hostnames instead of IPs internally because, I suppose, in this way it always resolve to the correct IP, even if it changes during time.

I think this fix will work for you - just add a line to /etc/hosts (you need sudo permissions):

127.0.0.1    lm-dev7-Desktop

Let me know if this solves you problem!

Great, I had the same issue and this solved it!
Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mzeidhassan picture mzeidhassan  路  6Comments

mzeidhassan picture mzeidhassan  路  6Comments

LoekvanKooten picture LoekvanKooten  路  3Comments

LoekvanKooten picture LoekvanKooten  路  4Comments

EtienneAb3d picture EtienneAb3d  路  6Comments