执行如下命令,发现报错
[[email protected] ~]$ hadoop distcp ftp://ftp01:[email protected]/test hdfs:///user/data Error: java.net.SocketException: 网络不可达 at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at org.apache.commons.net.SocketClient.connect(SocketClient.java:171) at org.apache.commons.net.SocketClient.connect(SocketClient.java:192) at org.apache.hadoop.fs.ftp.FTPFileSystem.connect(FTPFileSystem.java:133) at org.apache.hadoop.fs.ftp.FTPFileSystem.getFileStatus(FTPFileSystem.java:405) at org.apache.hadoop.tools.mapred.CopyMapper.map(CopyMapper.java:218) at org.apache.hadoop.tools.mapred.CopyMapper.map(CopyMapper.java:50) at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:787) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341) at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:163) 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:1671) at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
这是为什么呢?命令应该的正确的。
查网络,正常,ftp也能正常传输。
防火墙,selinux都已经关闭,但就是执行报错。
百思不得其解。
查了好多资料,才发现:
原来,hadoop官方不提供ftp接口!
只有个人开发的工具,感觉安装挺麻烦,也许还会有bug,参考资料链接:
http://www.linuxidc.com/Linux/2013-01/78302.htm
我就没安装了,现在是先把文件从ftp下载到本地,在通过
[[email protected] ~]$ hadoop fs -put test /user/data
上传到hadoop中,虽然麻烦点,但胜在稳定,后期也可通过脚本来简化步骤。
时间: 2024-10-10 05:29:18