Hadoop java socketexception无效参数

时间:2013-11-05 01:34:30

标签: java hadoop socketexception ubuntu-13.10

我正在学习Hadoop,它让我疯狂!我该怎么办?

root@youcheng1-OEM:/usr/local/hadoop-2.2.0# bin/hadoop fsck /      
DEPRECATED: Use of this script to execute hdfs command is deprecated. Instead use the hdfs command for it.
13/11/05 08:55:14 WARN fs.FileSystem: "1" is a deprecated filesystem name. Use "hdfs://1/" instead.  
13/11/05 08:55:20 ERROR  security.UserGroupInformation: PriviledgedActionException as:root       
(auth:SIMPLE) cause:java.io.IOException: Failed on local exception: java.net.SocketException: 无效的参数; Host Details : 
local host is: "youcheng1-OEM/192.168.1.192"; 
destination host is: "0.0.0.1":8020;      
Exception in thread "main" java.io.IOException: Failed on local exception: java.net.SocketException: 无效的参数; 
Host Details : local host is: "youcheng1-OEM/192.168.1.192"; 
destination host is: "0.0.0.1":8020;    
at  org.apache.hadoop.net.NetUtils.wrapException(NetUtils.java:764)     
at  org.apache.hadoop.ipc.Client.call(Client.java:1351)     
at  org.apache.hadoop.ipc.Client.call(Client.java:1300)     
at  org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:206)      
at  com.sun.proxy.$Proxy9.getFileInfo(Unknown Source)   
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.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:186)     
at  org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:102)  
at  com.sun.proxy.$Proxy9.getFileInfo(Unknown Source)   
at  org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.getFileInfo(ClientNamenodeProtocolTranslatorPB.java:651)       
at  org.apache.hadoop.hdfs.DFSClient.getFileInfo(DFSClient.java:1679)       
at  org.apache.hadoop.hdfs.DistributedFileSystem$17.doCall(DistributedFileSystem.java:1106)   
at  org.apache.hadoop.hdfs.DistributedFileSystem$17.doCall(DistributedFileSystem.java:1102)   
at  org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)            at org.apache.hadoop.hdfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:1102)
at  org.apache.hadoop.fs.FileSystem.exists(FileSystem.java:1397)    
at  org.apache.hadoop.hdfs.HAUtil.getAddressOfActive(HAUtil.java:303)   
at  org.apache.hadoop.hdfs.tools.DFSck.getCurrentNamenodeAddress(DFSck.java:229)    
at  org.apache.hadoop.hdfs.tools.DFSck.doWork(DFSck.java:235)   
at  org.apache.hadoop.hdfs.tools.DFSck.access$000(DFSck.java:71)    
at  org.apache.hadoop.hdfs.tools.DFSck$1.run(DFSck.java:134)    
at  org.apache.hadoop.hdfs.tools.DFSck$1.run(DFSck.java:131)    
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:1491)    
at  org.apache.hadoop.hdfs.tools.DFSck.run(DFSck.java:130)  
at  org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)   
at  org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84)   
at  org.apache.hadoop.hdfs.tools.DFSck.main(DFSck.java:316) Caused by:       java.net.SocketException: 无效的参数    
at  sun.nio.ch.Net.connect0(Native       Method)    
at  sun.nio.ch.Net.connect(Net.java:465)    
at  sun.nio.ch.Net.connect(Net.java:457)    
at  sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:666)    
at  org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:192)     
at  org.apache.hadoop.net.NetUtils.connect(NetUtils.java:529)   
at  org.apache.hadoop.net.NetUtils.connect(NetUtils.java:493)   
at  org.apache.hadoop.ipc.Client$Connection.setupConnection(Client.java:547)    
at  org.apache.hadoop.ipc.Client$Connection.setupIOstreams(Client.java:642)      
at  org.apache.hadoop.ipc.Client$Connection.access$2600(Client.java:314)    
at  org.apache.hadoop.ipc.Client.getConnection(Client.java:1399)    
at  org.apache.hadoop.ipc.Client.call(Client.java:1318)     
... 30    more

2 个答案:

答案 0 :(得分:0)

尝试从其他主机连接到HDFS NameNode时,我遇到了同样的错误(SocketException: invalid paramemter)。

如果您能够在NameNode上运行bin/hadoop fs -ls /,那么您应该检查客户端主机(或运行DataNode的主机)上的/etc/hosts。在您的情况下,请查找“127.0.0.1 youcheng1-OEM”行。我通过添加以下行来解决我的问题:

#127.0.0.1 youcheng1-OEM
127.0.0.1 localhost
192.168.1.192 youcheng1-OEM

Hadoop似乎将youcheng1-OEM解析为127.0.0.1并将其传递给sun.nio.ch.SocketChannelImpl.connect(...)

答案 1 :(得分:0)

Add the following line to your /etc/hosts file

0.0.0.1 localhost