i have some java systems that i want to use hadoop in with it, but whenever i connect to localhost with this command

hadoop fs -ls /

it will always prompt that

java.net.UnknownHostException: local.localdomain: diginiqlinux.localdomain
at java.net.InetAddress.getLocalHost(InetAddress.java:1466)


here is my //etc/hosts localhost

full trace log

[root@diginiqlinux ~]# hadoop fs -ls
13/12/30 16:44:36 INFO metrics.MetricsUtil: Unable to obtain hostName
java.net.UnknownHostException: diginiqlinux.localdomain: diginiqlinux.localdomai                                                                                        n
        at java.net.InetAddress.getLocalHost(InetAddress.java:1466)
        at org.apache.hadoop.metrics.MetricsUtil.getHostName(MetricsUtil.java:91                                                                                        )
        at org.apache.hadoop.metrics.MetricsUtil.createRecord(MetricsUtil.java:8                                                                                        0)
        at org.apache.hadoop.security.UserGroupInformation$UgiMetrics.<init>(Use                                                                                        rGroupInformation.java:102)
        at org.apache.hadoop.security.UserGroupInformation.<clinit>(UserGroupInf                                                                                        ormation.java:208)
        at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:1757                                                                                        )
        at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:1750                                                                                        )
        at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1618)
        at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:255)
        at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:124)
        at org.apache.hadoop.fs.FsShell.init(FsShell.java:86)
        at org.apache.hadoop.fs.FsShell.run(FsShell.java:1813)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:79)
        at org.apache.hadoop.fs.FsShell.main(FsShell.java:1974)
Caused by: java.net.UnknownHostException: diginiqlinux.localdomain
        at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
        at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:894)
        at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:128                                                                                        6)
        at java.net.InetAddress.getLocalHost(InetAddress.java:1462)
        ... 14 more
ls: Cannot access .: No such file or directory.

any solution how to connect localhost?

  • You are probably not able to 'ping localhost' either. Post the output of the 'ping localhost' command if possible.
    – Jay
    Dec 30, 2013 at 6:42
  • @Jay i can ping to localhost and Dec 30, 2013 at 7:30
  • The second line in your /etc/hosts is invalid; remove it.
    – psusi
    Dec 30, 2013 at 15:19

2 Answers 2


Add entry for localhost in /etc/hosts file. localhost

In the /etc/hosts file, there may be a [hostname] line. I would change that to [hostname]. I believe it is needed in order for sudo to work properly and there is generally an issue with it. http://wiki.apache.org/hadoop/ConnectionRefused The core-site.xml could also use localhost or the hostname, make sure it's configured properly.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.