执行字数计算程序时出现hadoop错误

58wvjzkj  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(298)

我是hadoop编程的初学者,我试着在hadoop包中运行单词计数程序。
我运行命令并面对下面的错误。我试着在网上搜索同样的问题,但解决不了。我认为我的问题与配置文件中的权限有关。

./bin/hadoop jar hadoop-examples-1.0.3.jar wordcount README.txt ~/wordcount-output

下面是我的错误。

16/05/04 00:05:26 INFO util.NativeCodeLoader: Loaded the native-hadoop library
16/05/04 00:05:26 INFO mapred.JobClient: Cleaning up the staging area file:/tmp/hadoop-sclee1/mapred/staging/sclee1466120821/.staging/job_local_0001
16/05/04 00:05:26 ERROR security.UserGroupInformation: PriviledgedActionException as:sclee1 cause:java.net.UnknownHostException: NGS1: NGS1: Name or service not known
java.net.UnknownHostException: NGS1: NGS1: Name or service not known
        at java.net.InetAddress.getLocalHost(InetAddress.java:1496)
        at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:874)
        at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:850)
        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:1121)
        at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:850)
        at org.apache.hadoop.mapreduce.Job.submit(Job.java:500)
        at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:530)
        at org.apache.hadoop.examples.WordCount.main(WordCount.java:67)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.hadoop.util.ProgramDriver$ProgramDescription.invoke(ProgramDriver.java:68)
        at org.apache.hadoop.util.ProgramDriver.driver(ProgramDriver.java:139)
        at org.apache.hadoop.examples.ExampleDriver.main(ExampleDriver.java:64)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
Caused by: java.net.UnknownHostException: NGS1: Name or service not known
        at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
        at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:922)
        at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1316)
        at java.net.InetAddress.getLocalHost(InetAddress.java:1492)
        ... 21 more

为了更好地理解,sclee1是我的帐户,ngs1是我的linux服务器,它是centos版本。
我努力解决它的问题,但失败了。

wb1gzix0

wb1gzix01#

检查并添加主机名与中所有节点上的主节点和从节点的ip地址之间的关联 /etc/hosts 文件。确保集群中的所有节点都能够彼此ping。
配置示例: /etc/hosts 文件如下:

127.0.0.1       localhost       NGS1

相关问题