我正在尝试在运行OSX 10.9的MacBook Pro上以伪分布式模式运行Hadoop 2.3。我看到以下错误:

14/04/09 15:05:43 WARN net.DNS: Unable to determine address of the host-falling back to "localhost" address
java.net.UnknownHostException: crowlem8: crowlem8
    at java.net.InetAddress.getLocalHost(InetAddress.java:1473)
    at org.apache.hadoop.net.DNS.resolveLocalHostIPAddress(DNS.java:287)
    at org.apache.hadoop.net.DNS.<clinit>(DNS.java:58)
    at org.apache.hadoop.hdfs.server.namenode.NNStorage.newBlockPoolID(NNStorage.java:914)
    at org.apache.hadoop.hdfs.server.namenode.NNStorage.newNamespaceInfo(NNStorage.java:550)
    at org.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:144)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:829)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1218)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1325)
Caused by: java.net.UnknownHostException: crowlem8
    at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
    at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)
    at java.net.InetAddress.getLocalHost(InetAddress.java:1469)

关于如何解决这个问题有什么想法吗?我在CentOS上格式化HDFS时看到了关于UnknownHostExceptions的related question。不确定如何根据该答案进行操作。

最佳答案

原来的解决方案是将以下内容添加到/ etc / hosts中:
127.0.0.1 localhost.localdomain本地主机

在上述情况下是crowlem8

08-07 15:43