Hadoop fs -put有DataStreamer Exception java.nio.channels.UnresolvedAddressException

时间:2017-09-28 22:54:22

标签: hadoop docker-compose

我已经启动了以下docker容器

namenode  
datanode1  
datanode2  
datanode3

当我尝试按如下方式将文件放入HDFS时,我收到此错误

hdfs dfs -put /tmp/airline-2008.csv.bz2 hdfs://namenode.bigdatacluster.com:8020/data/
  

17/09/28 22:49:01 WARN hdfs.DataStreamer:DataStreamer Exception   java.nio.channels.UnresolvedAddressException           at sun.nio.ch.Net.checkAddress(Net.java:101)           at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:622)           在org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:192)           在org.apache.hadoop.net.NetUtils.connect(NetUtils.java:531)           在org.apache.hadoop.hdfs.DataStreamer.createSocketForPipeline(DataStreamer.java:226)           在org.apache.hadoop.hdfs.DataStreamer.createBlockOutputStream(DataStreamer.java:1591)           在org.apache.hadoop.hdfs.DataStreamer.nextBlockOutputStream(DataStreamer.java:1547)           在org.apache.hadoop.hdfs.DataStreamer.run(DataStreamer.java:658)放:   java.nio.channels.UnresolvedAddressException

1 个答案:

答案 0 :(得分:1)

来自Oracle java doc,

Unchecked exception thrown when an attempt is made to invoke a network operation upon an unresolved socket address

这意味着hdfs URL中使用的主机名namenode.bigdatacluster.com无法解析为IP地址。您可以通过将主机到IP映射添加到/etc/hosts文件来解决此问题。