Hadoop Java API 开发操作时hdfs 时出现如下错误:
先翻译一把:
could only be replicated to 0 nodes instead of minReplication (=1). There are 1 datanode(s) running
只能复制到0个节点,而不是minReplication(=1)。有一个datanode(s)运行
就是说:多个nodedata要做副本处理,结果当前只有一个节点,但是不能到这一个节点。因此失败:为什么失败呢 ???
就是尼玛的端口问题,不知道的朋友,把Linux的防火墙关了即可:
或者加上这一个行:centos7 的解决办法,50020、50010 端口开启即可:
# firewall-cmd --permanent --add-port=50020/tcp
# firewall-cmd --permanent --add-port=50010/tcp
然后再重启防火墙:systemctl restart firewalld.service
org.apache.hadoop.ipc.RemoteException(java.io.IOException): File /hdfsapi/test/liuxing1.txt 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.
at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:617)at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:1073)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2086)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2082)
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:1693)
at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2080)
端口开启就是:50010
Hadoop 端口使用的详情:
https://blog.csdn.net/jeffiny/article/details/78728965