解决could only be written to 0 of the 1 minReplication nodes,there are 0 datanode(s) running问题

org.apache.hadoop.ipc.RemoteException: File /ai/flink/checkpoint/data/topi-ord-day-b/checkpoint-meta/87134/8d491e6e4b84eee3d25b6db1f1e301d1/shared/72e36ca2-8525-4f7d-a7d4-aa85ea583f78 could only be written to 0 of the 1 minReplication nodes. There are 4 datanode(s) running and 4 node(s) are excluded in this operation.
	at org.apache.hadoop.hdfs.server.blockmanagement.BlockManager.chooseTarget4NewBlock(BlockManager.java:2319)
	at org.apache.hadoop.hdfs.server.namenode.FSDirWriteFileOp.chooseTargetForNewBlock(FSDirWriteFileOp.java:294)
	at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:2731)
	at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.addBlock(NameNodeRpcServer.java:902)
	at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.addBlock(ClientNamenodeProtocolServerSideTranslatorPB.java:568)
	at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(ClientNamenodeProtocolProtos.java)
	at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:527)
	at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:1036)
	at org.apache.hadoop.ipc.Server$RpcCall.run(Server.java:1000)
	at org.apache.hadoop.ipc.Server$RpcCall.run(Server.java:928)
	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:1729)
	at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2916)

	at org.apache.hadoop.ipc.Client.getRpcResponse(Client.java:1511) ~[flink-shaded-hadoop-2-uber-3.2.0-vipshop-1.9-10.0.jar:3.2.0-vipshop-1.9-10.0]
	at org.apache.hadoop.ipc.Client.call(Client.java:1457) ~[flink-shaded-hadoop-2-uber-3.2.0-vipshop-1.9-10.0.jar:3.2.0-vipshop-1.9-10.0]
	at org.apache.hadoop.ipc.Client.call(Client.java:1367) ~[flink-shaded-hadoop-2-uber-3.2.0-vipshop-1.9-10.0.jar:3.2.0-vipshop-1.9-10.0]
	at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:228) ~[flink-shaded-hadoop-2-uber-3.2.0-vipshop-1.9-10.0.jar:3.2.0-vipshop-1.9-10.0]
	at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:116) ~[flink-shaded-hadoop-2-uber-3.2.0-vipshop-1.9-10.0.jar:3.2.0-vipshop-1.9-10.0]
	at com.sun.proxy.$Proxy37.addBlock(Unknown Source) ~[?:?]
	at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.addBlock(ClientNamenodeProtocolTranslatorPB.java:513) ~[flink-shaded-hadoop-2-uber-3.2.0-vipshop-1.9-10.0.jar:3.2.0-vipshop-1.9-10.0]
	at sun.reflect.GeneratedMethodAccessor76.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_262]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_262]
	at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:422) ~[flink-shaded-hadoop-2-uber-3.2.0-vipshop-1.9-10.0.jar:3.2.0-vipshop-1.9-10.0]
	at org.apache.hadoop.io.retry.RetryInvocationHandler$Call.invokeMethod(RetryInvocationHandler.java:165) ~[flink-shaded-hadoop-2-uber-3.2.0-vipshop-1.9-10.0.jar:3.2.0-vipshop-1.9-10.0]
	at org.apache.hadoop.io.retry.RetryInvocationHandler$Call.invoke(RetryInvocationHandler.java:157) ~[flink-shaded-hadoop-2-uber-3.2.0-vipshop-1.9-10.0.jar:3.2.0-vipshop-1.9-10.0]
	at org.apache.hadoop.io.retry.RetryInvocationHandler$Call.invokeOnce(RetryInvocationHandler.java:95) ~[flink-shaded-hadoop-2-uber-3.2.0-vipshop-1.9-10.0.jar:3.2.0-vipshop-1.9-10.0]
	at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:359) ~[flink-shaded-hadoop-2-uber-3.2.0-vipshop-1.9-10.0.jar:3.2.0-vipshop-1.9-10.0]
	at com.sun.proxy.$Proxy38.addBlock(Unknown Source) ~[?:?]
	at org.apache.hadoop.hdfs.DFSOutputStream.addBlock(DFSOutputStream.java:1081) ~[flink-shaded-hadoop-2-uber-3.2.0-vipshop-1.9-10.0.jar:3.2.0-vipshop-1.9-10.0]
	at org.apache.hadoop.hdfs.DataStreamer.locateFollowingBlock(DataStreamer.java:1889) ~[flink-shaded-hadoop-2-uber-3.2.0-vipshop-1.9-10.0.jar:3.2.0-vipshop-1.9-10.0]
	at org.apache.hadoop.hdfs.DataStreamer.nextBlockOutputStream(DataStreamer.java:1691) ~[flink-shaded-hadoop-2-uber-3.2.0-vipshop-1.9-10.0.jar:3.2.0-vipshop-1.9-10.0]
	at org.apache.hadoop.hdfs.DataStreamer.run(DataStreamer.java:730) ~[flink-shaded-hadoop-2-uber-3.2.0-vipshop-1.9-10.0.jar:3.2.0-vipshop-1.9-10.0]

问题描述
在使用hive insert overwrite更新分区表的时候出现这个报错。意思是没用可用的DataNode了。

解决方案
网上看到的类似的解决方案有以下两种:

解决could only be written to 0 of the 1 minReplication nodes,there are 0 datanode(s) running问题_第1张图片

 

但我这里都不是。

我这里的原因是hdfs空间被占满了,而hive在执行的时候会往/tmp下读写大量的临时数据,由于没有空间而报错。

默认情况下,hive脚本执行完之后会自动清理掉这些临时文件。

这里之所以出现/tmp下大量文件没被清理,是因为之前自己有多次没等hive脚本执行完就Ctrl +c掉了,所以有大量临时文件未清理。

因此,最终的解决方案是删除掉这些没用的临时文件,腾出空间就好了。(最好在所有hive脚本都运行结束后再清理,否则可能会导致正在运行的脚本出现异常)
 

发现确实是磁盘不够导致重启

你可能感兴趣的:(java,flink,hadoop,hdfs,big,data)