Spring Boot YARN 不在 Hadoop 2.8.0 上运行客户端无法访问 DataNode
Posted
技术标签:
【中文标题】Spring Boot YARN 不在 Hadoop 2.8.0 上运行客户端无法访问 DataNode【英文标题】:Spring Boot YARN doesn't run on Hadoop 2.8.0 client cannot access DataNode 【发布时间】:2017-05-27 17:20:32 【问题描述】:我正在尝试运行 Spring Boot YARN 示例(Windows 上为https://spring.io/guides/gs/yarn-basic/)。在application.yml
中,我将fsUri
和resourceManagerHost
更改为指向我的VM 主机192.168...
。
但是当我尝试运行应用程序时出现异常:
DFSClient: Exception in createBlockOutputStream
java.net.ConnectException: Connection timed out: no further information
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)
at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:531)
at org.apache.hadoop.hdfs.DFSOutputStream.createSocketForPipeline(DFSOutputStream.java:1508)
at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.createBlockOutputStream(DFSOutputStream.java:1284)
at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.nextBlockOutputStream(DFSOutputStream.java:1237)
at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.run(DFSOutputStream.java:449)
[2017-05-27 19:59:49.570] boot - 7728 INFO [Thread-5] --- DFSClient: Abandoning BP-646365587-10.0.2.15-1495898351938:blk_1073741830_1006
[2017-05-27 19:59:49.602] boot - 7728 INFO [Thread-5] --- DFSClient: Excluding datanode DatanodeInfoWithStorage[10.0.2.15:50010,DS-f909ec7a-8374-4cdd-9cfc-0e778810d98c,DISK]
[2017-05-27 19:59:49.647] boot - 7728 WARN [Thread-5] --- DFSClient: DataStreamer Exception
org.apache.hadoop.ipc.RemoteException(java.io.IOException): File /app/gs-yarn-basic/gs-yarn-basic-container-0.1.0.jar could only be replicated to 0 nodes instead of minReplication (=1). There are 1 datanode(s) running and 1 node(s) are excluded in this operation.
这意味着无法从我的主机访问 DataNode。出于这个原因,我添加到 hdfs-site.xml
<property>
<name>dfs.client.use.datanode.hostname</name>
<value>true</value>
<description>Whether clients should use datanode hostnames when
connecting to datanodes.
</description>
</property>
但它仍然会抛出该异常。
我的虚拟机上运行着 Hadoop 2.8.0。这里是conf。文件:
核心站点.xml
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://0.0.0.0:9000</value>
</property>
</configuration>
hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>/usr/local/hadoop/hadoop-2.8.0/data/namenode</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>/usr/local/hadoop/hadoop-2.8.0/data/datanode</value>
</property>
<property>
<name>dfs.permissions.enabled</name>
<value>false</value>
</property>
<property>
<name>dfs.client.use.datanode.hostname</name>
<value>true</value>
<description>Whether clients should use datanode hostnames when
connecting to datanodes.
</description>
</property>
</configuration>
mapred-site.xml
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
yarn-site.xml
<configuration>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>
<property>
<name>yarn.scheduler.maximum-allocation-mb</name>
<value>8192</value>
</property>
<property>
<name>yarn.nodemanager.resource.memory-mb</name>
<value>8192</value>
</property>
<property>
<name>yarn.nodemanager.disk-health-checker.max-disk-utilization-per-
disk-percentage</name>
<value>99</value>
</property>
</configuration>
【问题讨论】:
你为什么把0.0.0.0:9000
放在`core-site.xml中?这应该是 IP 或主机名。
@RameshMaharjan,改IP后就可以了,谢谢
【参考方案1】:
您的core-site.xml
应该指向Namenode
地址,但目前它指向0.0.0.0
,这意味着本地计算机上的所有地址。这将产生模棱两可的结果,因为每台机器都应被视为Namenode
。
Namenode
在 hadoop 集群中应该只有一个。
将0.0.0.0
替换为Namenode
的ip
或hostname
应该可以解决您面临的问题。
【讨论】:
你认为它不应该被删除吗? 还不错【参考方案2】:在 core-site.xml 中将 0.0.0.0:9000 更改为 [VM's IP]:9000 后 Spring 连接到 YARN。感谢@RameshMaharjan
【讨论】:
@RameshMaharjan,哦,对不起:)谢谢! @RameshMaharjan,当然:)以上是关于Spring Boot YARN 不在 Hadoop 2.8.0 上运行客户端无法访问 DataNode的主要内容,如果未能解决你的问题,请参考以下文章
spring boot starter security 不在日志中生成默认密码
Spring Boot JPA 测试 bean 不在上下文中