docker上已经成功部署了hdfs应用,jps命令也显示了namenode和datanode启动正常。浏览器显示 宿主机ip:50070 页面
我在eclipse使用java连接hdfs,代码如下:
FileSystem hdfs;
Configuration conf = new Configuration();
try {
hdfs = FileSystem.get(new URI("hdfs://10.8.2.11:9999"),conf);
Path des =new Path("E:/AB4/hdfs/worksapce");
String srcPath = "/abcloud";
Path src = new Path(srcPath);
hdfs.copyFromLocalFile(false,true,des, src);
运行结果:
org.apache.hadoop.ipc.RemoteException(java.io.IOException): File /abcloud/test.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.hdfs.server.blockmanagement.BlockManager.chooseTarget4NewBlock(BlockManager.java:1559)
at org.apache.hadoop.hdfs.server.name