欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

org.apache.hadoop.ipc.RemoteException(java.io.IOException)

程序员文章站 2022-03-02 17:01:13
...
昨晚突然之间mr跑步起来了
jps查看 进程都在的,但是在reduce任务跑了85%的时候会抛异常
异常情况如下:

2016-09-21 21:32:28,538 INFO [org.apache.hadoop.mapreduce.Job] -  map 100% reduce 84%
2016-09-21 21:32:30,623 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce
2016-09-21 21:32:33,626 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce
2016-09-21 21:32:36,627 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce
2016-09-21 21:32:39,628 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce
2016-09-21 21:32:42,630 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce
2016-09-21 21:32:45,632 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce
2016-09-21 21:32:48,634 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce
2016-09-21 21:32:51,634 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce
2016-09-21 21:32:54,636 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce
2016-09-21 21:32:57,638 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce
2016-09-21 21:33:00,639 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce
2016-09-21 21:33:03,641 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce
2016-09-21 21:33:04,554 INFO [org.apache.hadoop.mapreduce.Job] -  map 100% reduce 85%
2016-09-21 21:33:06,643 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce
2016-09-21 21:33:09,644 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce
2016-09-21 21:33:12,645 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce
2016-09-21 21:33:15,648 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce
2016-09-21 21:33:18,650 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce
2016-09-21 21:33:19,268 WARN [org.apache.hadoop.hdfs.DFSClient] - DataStreamer Exception
org.apache.hadoop.ipc.RemoteException(java.io.IOException): File /anagram/out/_temporary/0/_temporary/attempt_local946954997_0001_r_000000_0/part-r-00000
 could only be replicated to 0 nodes instead of minReplication (=1).  There are 1 datanode(s) running and no node(s) are excluded in this operation.
	at org.apache.hadoop.hdfs.server.blockmanagement.BlockManager.chooseTarget(BlockManager.java:1384)
	at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:2477)
	at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.addBlock(NameNodeRpcServer.java:555)
	at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.addBlock(ClientNamenodeProtocolServerSideTranslatorPB.java:387)
	at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java:59582)
	at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:585)
	at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:928)
	at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2048)
	at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2044)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:415)
	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1491)
	at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2042)

	at org.apache.hadoop.ipc.Client.call(Client.java:1347)
	at org.apache.hadoop.ipc.Client.call(Client.java:1300)
	at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:206)
	at com.sun.proxy.$Proxy9.addBlock(Unknown Source)
	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:186)
	at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:102)
	at com.sun.proxy.$Proxy9.addBlock(Unknown Source)
	at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.addBlock(ClientNamenodeProtocolTranslatorPB.java:330)
	at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.locateFollowingBlock(DFSOutputStream.java:1226)
	at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.nextBlockOutputStream(DFSOutputStream.java:1078)
	at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.run(DFSOutputStream.java:514)
2016-09-21 21:33:19,330 WARN [org.apache.hadoop.mapred.LocalJobRunner] - job_local946954997_0001
org.apache.hadoop.ipc.RemoteException(java.io.IOException): File /anagram/out/_temporary/0/_temporary/attempt_local946954997_0001_r_000000_0/part-r-00000 could only be replicated to 0 nodes instead of minReplication (=1).  There are 1 datanode(s) running and no node(s) are excluded in this operation.
	at org.apache.hadoop.hdfs.server.blockmanagement.BlockManager.chooseTarget(BlockManager.java:1384)
	at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:2477)
	at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.addBlock(NameNodeRpcServer.java:555)
	at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.addBlock(ClientNamenodeProtocolServerSideTranslatorPB.java:387)
	at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java:59582)
	at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:585)
	at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:928)
	at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2048)
	at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2044)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:415)
	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1491)
	at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2042)

	at org.apache.hadoop.ipc.Client.call(Client.java:1347)
	at org.apache.hadoop.ipc.Client.call(Client.java:1300)
	at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:206)
	at com.sun.proxy.$Proxy9.addBlock(Unknown Source)
	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:186)
	at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:102)
	at com.sun.proxy.$Proxy9.addBlock(Unknown Source)
	at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.addBlock(ClientNamenodeProtocolTranslatorPB.java:330)
	at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.locateFollowingBlock(DFSOutputStream.java:1226)
	at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.nextBlockOutputStream(DFSOutputStream.java:1078)
	at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.run(DFSOutputStream.java:514)
2016-09-21 21:33:19,560 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local946954997_0001 failed with state F

看到这里以为是副本问题
could only be replicated to 0 nodes instead of minReplication (=1). 


随后把副本改为三个还是出现此异常。然后把集群从启一下发现datanode没有能够启动
后面查看日志发现datanode启动异常
java.io.IOException: Incompatible clusterIDs in /data/dfs/data: namenode clusterID = CID-70f4fcbc-13a2-4918-a90a-5a7b4b47baa8; datanode clusterID = CID-be72a034-047f-4d49-bb40-dd411b8007e6
	at org.apache.hadoop.hdfs.server.datanode.DataStorage.doTransition(DataStorage.java:391)
	at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:191)
	at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:219)
	at org.apache.hadoop.hdfs.server.datanode.DataNode.initStorage(DataNode.java:837)
	at org.apache.hadoop.hdfs.server.datanode.DataNode.initBlockPool(DataNode.java:808)
	at org.apache.hadoop.hdfs.server.datanode.BPOfferService.verifyAndSetNamespaceInfo(BPOfferService.java:280)
	at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.connectToNNAndHandshake(BPServiceActor.java:222)
	at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.run(BPServiceActor.java:664)
	at java.lang.Thread.run(Thread.java:745)
2016-09-21 15:57:22,786 WARN org.apache.hadoop.hdfs.server.datanode.DataNode: Ending block pool service for: Block pool BP-1394444749-192.168.19.130-1474417014093 (storage id DS-433243534-192.168.19.130-50010-1473626296058) service to selfimpr/192.168.19.130:9000
2016-09-21 15:57:22,938 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Removed Block pool BP-1394444749-192.168.19.130-1474417014093 (storage id DS-433243534-192.168.19.130-50010-1473626296058)
2016-09-21 15:57:24,939 WARN org.apache.hadoop.hdfs.server.datanode.DataNode: Exiting Datanode
2016-09-21 15:57:24,940 INFO org.apache.hadoop.util.ExitUtil: Exiting with status 0

随后手动把namenode和datanode 的clusterID 统一了,后面集群启动成功,但是程序异常依旧,最后把namenode和datanode统一格式化,程序正常运行。

参考:
http://*.com/questions/15571584/writing-to-hdfs-could-only-be-replicated-to-0-nodes-instead-of-minreplication

https://issues.apache.org/jira/browse/HDFS-107

相关标签: Hadoop