2013-10-12 87 views
14

我是Hadoop的新手。我安裝的Hadoop我的Mac上使用該linkMAC僞節點上的Hadoop:節點名稱或服務名稱提供,或不知道

它的工作就像一個魅力對我來說,首先,但現在當我從Eclipse中運行相同的字計數問題,我打了這個問題:

ERROR security.UserGroupInformation: PriviledgedActionException as:<username> cause:java.net.UnknownHostException: <hostname>: <hostname>: hostname nor servname provided, or not known 
Exception in thread "main" java.net.UnknownHostException: <hostname>: <hostname>: nodename nor servname provided, or not known 
    at java.net.InetAddress.getLocalHost(InetAddress.java:1466) 
    at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:960) 
    at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:936) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at javax.security.auth.Subject.doAs(Subject.java:415) 
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1190) 
    at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:936) 
    at org.apache.hadoop.mapreduce.Job.submit(Job.java:550) 
    at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:580) 
    at WordCount.main(WordCount.java:57) 
Caused by: java.net.UnknownHostException: <hostname>: nodename nor servname provided, or not known 
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) 

這是怎麼了我的conf文件看:

核心的site.xml:

<configuration> 

<property> 
    <name>fs.default.name</name> 
    <value>hdfs://localhost:9000</value> 
</property> 

</configuration> 

hadoop-env.sh

具有以下項,除了默認值:

export HADOOP_OPTS="-Djava.security.krb5.realm=OX.AC.UK -Djava.security.krb5.kdc=kdc0.ox.ac.uk:kdc1.ox.ac.uk" 

HDFS-site.xml中

<configuration> 

<property> 
    <name>dfs.replication</name> 
    <value>1</value> 
</property> 

</configuration> 

mapred-site.xml中

<configuration> 
<property> 
    <name>mapred.job.tracker</name> 
    <value>localhost:9001</value> 
</property> 
</configuration> 

我也看到這個錯誤的開頭:

2013-10-11 21:03:08.795 java[7484:1903] Unable to load realm mapping info from SCDynamicStore 
13/10/11 21:03:08 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 
13/10/11 21:03:08 WARN mapred.JobClient: Use GenericOptionsParser for parsing the arguments. Applications should implement Tool for the same. 
13/10/11 21:03:08 WARN mapred.JobClient: No job jar file set. User classes may not be found. See JobConf(Class) or JobConf#setJar(String). 
13/10/11 21:03:08 INFO mapred.JobClient: Cleaning up the staging area file:/tmp/hadoop-<uname>/mapred/staging/<uname>386844365/.staging/job_local386844365_0001 

有人可以告訴我,如果我做錯了什麼?我的程序是相同的,並且還沒有改變的問題是與主機文件(用於工作)的默認

感謝

回答

33

。加入這個到/ etc固定它/ hosts文件:

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 
127.0.1.1 <hostname> 
21

你可以用一個簡單的命令解決這個問題:

echo "127.0.0.1 $HOSTNAME" | sudo tee -a /etc/hosts 

Source

+3

謹慎使用此命令。根據您的shell和/或環境,$ HOSTNAME可能不可用。對於bash而言,沒有問題,對於zsh也沒關係。 –

+0

謝謝引用來源。 –

相關問題