java.net.UnknownHostException: master: master: unknown error

If you like a tip written by other Samebug users, mark is as helpful! Marks help our algorithm provide you better solutions and also help other users.
tip

When kafka creates new consumers, it simply concatenate the name of your VM to generate the consumer id. So, your VM resolves localhost as the name of your VM, not whatever you had set. To solve, add kafka(or the name of VM) plus address to /etc/hosts

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • quick start not working
    via by n3xus,
  • SparkContext sc not found in Spark shell
    via Stack Overflow by Mahtab
    ,
  • Trouble installing Pyspark
    via by Unknown author,
  • Can't run Spark 1.2 in standalone mode on Mac
    via by Unknown author,
  • Error trying to run pySpark on my own machine
    via Stack Overflow by Huey
    ,
  • Error when trying to spin spark in standalone mode
    via Stack Overflow by Amit
    ,
    • java.net.UnknownHostException: master: master: unknown error at java.net.InetAddress.getLocalHost(InetAddress.java:1505) at org.apache.spark.util.Utils$.findLocalInetAddress(Utils.scala:789) at org.apache.spark.util.Utils$.org$apache$spark$util$Utils$$localIpAddress$lzycompute(Utils.scala:782) at org.apache.spark.util.Utils$.org$apache$spark$util$Utils$$localIpAddress(Utils.scala:782) at org.apache.spark.util.Utils$$anonfun$localHostName$1.apply(Utils.scala:839) at org.apache.spark.util.Utils$$anonfun$localHostName$1.apply(Utils.scala:839) at scala.Option.getOrElse(Option.scala:121) at org.apache.spark.util.Utils$.localHostName(Utils.scala:839) at org.apache.spark.SparkContext.<init>(SparkContext.scala:420) at TestMain$.main(TestMain.scala:8) at TestMain.main(TestMain.scala) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) Caused by: java.net.UnknownHostException: master: unknown error 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) ... 15 more

    Users with the same issue

    Unknown visitor1 times, last one,
    nasimk
    nasimk2 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    raj76
    raj762 times, last one,
    60 more bugmates