eclipse執行hadoop的job提示Invalid host name: local host is: (unknown)
阿新 • • 發佈:2019-02-10
hadoop叢集的namenode安裝在centos65上,主機名為CentOS65App,同時在CentOS65App上也安裝了eclipse,在eclipse中執行hadoop的Job程式碼,提示
Exception in thread "main" java.net.UnknownHostException: Invalid host name: local host is: (unknown); destination host is: "CentOS65App":8020; java.net.UnknownHostException; For more details see: http://wiki.apache.org/hadoop/UnknownHost at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.apache.hadoop.net.NetUtils.wrapWithMessage(NetUtils.java:824) at org.apache.hadoop.net.NetUtils.wrapException(NetUtils.java:767) at org.apache.hadoop.ipc.Client$Connection.<init>(Client.java:447) at org.apache.hadoop.ipc.Client.getConnection(Client.java:1534) at org.apache.hadoop.ipc.Client.call(Client.java:1385) at org.apache.hadoop.ipc.Client.call(Client.java:1349) at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:227) at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:116) at com.sun.proxy.$Proxy10.getFileInfo(Unknown Source) at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.getFileInfo(ClientNamenodeProtocolTranslatorPB.java:796) 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 org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:422) at org.apache.hadoop.io.retry.RetryInvocationHandler$Call.invokeMethod(RetryInvocationHandler.java:165) at org.apache.hadoop.io.retry.RetryInvocationHandler$Call.invoke(RetryInvocationHandler.java:157) at org.apache.hadoop.io.retry.RetryInvocationHandler$Call.invokeOnce(RetryInvocationHandler.java:95) at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:359) at com.sun.proxy.$Proxy11.getFileInfo(Unknown Source) at org.apache.hadoop.hdfs.DFSClient.getFileInfo(DFSClient.java:1717) at org.apache.hadoop.hdfs.DistributedFileSystem$29.doCall(DistributedFileSystem.java:1526) at org.apache.hadoop.hdfs.DistributedFileSystem$29.doCall(DistributedFileSystem.java:1523) at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81) at org.apache.hadoop.hdfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:1523) at org.apache.hadoop.fs.FileSystem.exists(FileSystem.java:1627) at org.apache.hadoop.mapreduce.lib.output.FileOutputFormat.checkOutputSpecs(FileOutputFormat.java:145) at org.apache.hadoop.mapreduce.JobSubmitter.checkSpecs(JobSubmitter.java:279) at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:145) at org.apache.hadoop.mapreduce.Job$11.run(Job.java:1570) at org.apache.hadoop.mapreduce.Job$11.run(Job.java:1567) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:422) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1886) at org.apache.hadoop.mapreduce.Job.submit(Job.java:1567) at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1588) at com.fhbean.hadoop.test.MaxTemperature.main(MaxTemperature.java:71) Caused by: java.net.UnknownHostException ... 35 more
問題解決步驟:
增加主機配置後,Job程式可以在eclipse中跑通ping CentOS65App 64 bytes from CentOS65App. (172.16.2.105): icmp_seq=1 ttl=64 time=0.025 ms 64 bytes from CentOS65App. (172.16.2.105): icmp_seq=2 ttl=64 time=0.024 ms 64 bytes from CentOS65App. (172.16.2.105): icmp_seq=3 ttl=64 time=0.027 ms 64 bytes from CentOS65App. (172.16.2.105): icmp_seq=4 ttl=64 time=0.028 ms 64 bytes from CentOS65App. (172.16.2.105): icmp_seq=5 ttl=64 time=0.025 ms ...... ping CentOS65App. //注意最後有個"." ping: unknown host CentOS65App. cat /etc/hosts 172.16.2.105 CentOS65App ... vi /etc/hosts 172.16.2.105 CentOS65App. CentOS65App #這裡增加一個主機名,尾部帶"."