数据节点处于活动状态,但我无法将文件复制到HDFS [Hadoop 2.6.0 - Raspberry Pi Cluster]

时间:2016-01-12 08:29:54

标签: hadoop hdfs raspberry-pi2

我一直致力于使用Raspberry Pis的Hadoop群集,仅用于学习目的。我已经成功配置了所有Slaves和Master(据我所知)。

问题: HDFS无法复制本地文件。根据 http://Master:8088 我有3个活动节点。 (我在最后附上了截图)

但是当我尝试将本地文件复制到HDFS时,我得到以下异常:

16/01/12 06:20:43 WARN hdfs.DFSClient: DataStreamer Exception
org.apache.hadoop.ipc.RemoteException(java.io.IOException): File /LICENCE.txt._COPYING_ could only be replicated to 0 nodes instead of minReplication (=1).  There are 0 datanode(s) running and no node(s) are excluded in this operation.
        at org.apache.hadoop.hdfs.server.blockmanagement.BlockManager.chooseTarget4NewBlock(BlockManager.java:1549)
        at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:3200)
        at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.addBlock(NameNodeRpcServer.java:641)
        at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.addBlock(ClientNamenodeProtocolServerSideTranslatorPB.java:482)
        at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)
        at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:619)
        at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:962)
        at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2039)
        at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2035)
        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:1628)
        at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2033)

        at org.apache.hadoop.ipc.Client.call(Client.java:1468)
        at org.apache.hadoop.ipc.Client.call(Client.java:1399)
        at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:232)
        at com.sun.proxy.$Proxy9.addBlock(Unknown Source)
        at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.addBlock(ClientNamenodeProtocolTranslatorPB.java:399)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:187)
        at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:102)
        at com.sun.proxy.$Proxy10.addBlock(Unknown Source)
        at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.locateFollowingBlock(DFSOutputStream.java:1532)
        at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.nextBlockOutputStream(DFSOutputStream.java:1349)
        at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.run(DFSOutputStream.java:588)
put: File /LICENCE.txt._COPYING_ could only be replicated to 0 nodes instead of minReplication (=1).  There are 0 datanode(s) running and no node(s) are excluded in this operation.

以下是我在奴隶和主人的配置

核心-site.xml中:

<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://Master:9000</value>
</property>
</configuration>

mapred-site.xml中

<configuration>
<property>
      <name>mapreduce.framework.name</name>
      <value>yarn</value>
</property>
<property>
        <name>mapreduce.job.tracker</name>
        <value>Master:5431</value>
</property>>
</configuration>

HD​​FS-site.xml中

<configuration>
 <property>
      <name>dfs.namenode.name.dir</name>
      <value>file:/usr/local/hadoop_tmp/hdfs/namenode</value>
 </property>
 <property>
      <name>dfs.datanode.data.dir</name>
      <value>file:/usr/local/hadoop_tmp/hdfs/datanode</value>
 </property>
 <property>
  <name>dfs.replication</name>
  <value>4</value>
 </property>
</configuration>

纱-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.resourcemanager.resource-tracker.address</name>
        <value>Master:8025</value>
</property>
<property>
        <name>yarn.resourcemanager.scheduler.address</name>
        <value>Master:8035</value>
</property>
<property>
        <name>yarn.resourcemanager.address</name>
        <value>Master:8050</value>
</property>
</configuration>

当我在Master上运行 JPS 时:

1218 ResourceManager
2147 Jps
1034 SecondaryNameNode
879 NameNode

当我在Slaves上运行 JPS 时:

1270 Jps
1118 NodeManager

Active Node Screenshot 我真的很感谢你们,请帮助我。我在StackoverFlow上搜索了很多东西,但无法修复它。删除了临时目录,格式化了namenode和datanode。

如果你需要其他任何东西用于调试目的,我会在这里。

非常感谢!

此致 Maher Shahmeer

2 个答案:

答案 0 :(得分:1)

对于奴隶和主人,你的hdfs-site.xml应该是不同的。

  1. 名称节点设置必须

    <configuration>
     <property>
      <name>dfs.namenode.name.dir</name>
      <value>file:/usr/local/hadoop_tmp/hdfs/namenode</value>
     </property>
    <property>
      <name>dfs.replication</name>
      <value>4</value>
     </property>
    </configuration>
    
  2. 并且所有从属节点都应具有以下设置

    <configuration>
     <property>
      <name>dfs.datanode.data.dir</name>
      <value>file:/usr/local/hadoop_tmp/hdfs/datanode</value>
     </property>
     <property>
      <name>dfs.replication</name>
      <value>4</value>
     </property>
    </configuration>
    
  3. 您的slaves配置文件应包含数据节点的所有IP。
  4. 最后停止并重新启动hadoop群集。问题将得到解决。祝你好运。

答案 1 :(得分:0)

我似乎无法在您的slave / master上运行datanode进程