hadoop搭建,上传文件时出现错误,没有到主机的路由

本文记录了在使用Hadoop进行文件上传时遇到的“没有到主机的路由”错误,并详细解析了该错误的原因及解决方案,包括检查Namenode与DataNode节点之间的网络连接和配置等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[hadoop@Master file]hadoopfsmkdirinput3[hadoop@Masterfile] hadoop fs -put ./file*.txt input3
15/03/18 22:54:00 INFO hdfs.DFSClient: Exception in createBlockOutputStream java.net.NoRouteToHostException: 没有到主机的路由
15/03/18 22:54:00 INFO hdfs.DFSClient: Abandoning block blk_-2701910714669546890_10073
15/03/18 22:54:06 INFO hdfs.DFSClient: Exception in createBlockOutputStream java.net.NoRouteToHostException: 没有到主机的路由
15/03/18 22:54:06 INFO hdfs.DFSClient: Abandoning block blk_-6595394394333564261_10073
15/03/18 22:54:12 INFO hdfs.DFSClient: Exception in createBlockOutputStream java.net.NoRouteToHostException: 没有到主机的路由
15/03/18 22:54:12 INFO hdfs.DFSClient: Abandoning block blk_-7654232478902170768_10073
15/03/18 22:54:18 INFO hdfs.DFSClient: Exception in createBlockOutputStream java.net.NoRouteToHostException: 没有到主机的路由
15/03/18 22:54:18 INFO hdfs.DFSClient: Abandoning block blk_-4057949388287825875_10074
15/03/18 22:54:24 WARN hdfs.DFSClient: DataStreamer Exception: java.io.IOException: Unable to create new block.
at org.apache.hadoop.hdfs.DFSClientDFSOutputStream.nextBlockOutputStream(DFSClient.java:2845)atorg.apache.hadoop.hdfs.DFSClientDFSOutputStream.access2000(DFSClient.java:2102)atorg.apache.hadoop.hdfs.DFSClientDFSOutputStream$DataStreamer.run(DFSClient.java:2288)

15/03/18 22:54:24 WARN hdfs.DFSClient: Error Recovery for block blk_-4057949388287825875_10074 bad datanode[0] nodes == null
15/03/18 22:54:24 WARN hdfs.DFSClient: Could not get block locations. Source file “/user/hadoop/input3/file1.txt” - Aborting…
15/03/18 22:54:24 INFO hdfs.DFSClient: Exception in createBlockOutputStream java.net.NoRouteToHostException: 没有到主机的路由
15/03/18 22:54:24 INFO hdfs.DFSClient: Abandoning block blk_-7080188390242653981_10075
15/03/18 22:54:30 INFO hdfs.DFSClient: Exception in createBlockOutputStream java.net.NoRouteToHostException: 没有到主机的路由
15/03/18 22:54:30 INFO hdfs.DFSClient: Abandoning block blk_-6858744431122541922_10075
15/03/18 22:54:36 INFO hdfs.DFSClient: Exception in createBlockOutputStream java.net.NoRouteToHostException: 没有到主机的路由
15/03/18 22:54:36 INFO hdfs.DFSClient: Abandoning block blk_-5335567731842422100_10075
15/03/18 22:54:42 INFO hdfs.DFSClient: Exception in createBlockOutputStream java.net.NoRouteToHostException: 没有到主机的路由
15/03/18 22:54:42 INFO hdfs.DFSClient: Abandoning block blk_7680139810007024027_10075
15/03/18 22:54:48 WARN hdfs.DFSClient: DataStreamer Exception: java.io.IOException: Unable to create new block.
at org.apache.hadoop.hdfs.DFSClientDFSOutputStream.nextBlockOutputStream(DFSClient.java:2845)atorg.apache.hadoop.hdfs.DFSClientDFSOutputStream.access2000(DFSClient.java:2102)atorg.apache.hadoop.hdfs.DFSClientDFSOutputStream$DataStreamer.run(DFSClient.java:2288)

15/03/18 22:54:48 WARN hdfs.DFSClient: Error Recovery for block blk_7680139810007024027_10075 bad datanode[0] nodes == null
15/03/18 22:54:48 WARN hdfs.DFSClient: Could not get block locations. Source file “/user/hadoop/input3/file2.txt” - Aborting…
put: 没有到主机的路由
没有到主机的路由

15/03/18 22:54:48 ERROR hdfs.DFSClient: Exception closing file /user/hadoop/input3/file1.txt : java.net.NoRouteToHostException: 没有到主机的路由
java.net.NoRouteToHostException: 没有到主机的路由
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739)
at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)
at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:404)
at org.apache.hadoop.hdfs.DFSClientDFSOutputStream.createBlockOutputStream(DFSClient.java:2870)atorg.apache.hadoop.hdfs.DFSClientDFSOutputStream.nextBlockOutputStream(DFSClient.java:2826)
at org.apache.hadoop.hdfs.DFSClientDFSOutputStream.access2000(DFSClient.java:2102)
at org.apache.hadoop.hdfs.DFSClientDFSOutputStreamDataStreamer.run(DFSClient.java:2288)
15/03/18 22:54:48 ERROR hdfs.DFSClient: Exception closing file /user/hadoop/input3/file2.txt : java.net.NoRouteToHostException: 没有到主机的路由
java.net.NoRouteToHostException: 没有到主机的路由
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739)
at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)
at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:404)
at org.apache.hadoop.hdfs.DFSClientDFSOutputStream.createBlockOutputStream(DFSClient.java:2870)atorg.apache.hadoop.hdfs.DFSClientDFSOutputStream.nextBlockOutputStream(DFSClient.java:2826)
at org.apache.hadoop.hdfs.DFSClientDFSOutputStream.access2000(DFSClient.java:2102)
at org.apache.hadoop.hdfs.DFSClientDFSOutputStreamDataStreamer.run(DFSClient.java:2288)

解决方案:
(1)从namenode主机ping其它slaves节点的主机名(注意是slaves节点的主机名),如果ping不通,原因可能是namenode节点的/etc/hosts 未配置主机名与IP地址的映射关系,补全主机名与IP地址的映射关系。

(2)从datanode主机ping master节点的主机名(注意也是节点的主机名),如果ping不通,原因可能是datenode节点的/etc/hosts 未配置主机名与IP地址的映射关系,补全主机名与IP地址的映射关系。

(3)查看各机器节点的防火墙是否关闭(或者设置防火墙开启,但对我们的指定端口开放,最好是关闭防火墙):

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值