Sandbox HDP - 1 datanode(s) running and 1 node(s) are excluded

I have installed HDP 2.5 from VirtualBox.
I can run all the Web interfaces for Amabari, NameNode, DataNode & all others.

I have a simple java program to copy files from my local windows machine to HDFS.

I am getting below error:
org.apache.hadoop.ipc.RemoteException( File /user/anil/wxeventcardschecknotpass.csv 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(
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getNewBlockTargets(
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(
at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.addBlock(
at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.addBlock(
at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(
at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$
at org.apache.hadoop.ipc.RPC$
at org.apache.hadoop.ipc.Server$Handler$
at org.apache.hadoop.ipc.Server$Handler$
at Method)
at org.apache.hadoop.ipc.Server$

My code is:

public class HdfsWrite {
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
conf.set(“dfs.client.use.datanode.hostname”, “true”);

private static void uploadSolution2(Configuration conf) throws Exception{
    try {
        String localStr ="C://w2bc//data//wxeventcardschecknotpass.csv";
        String dst = "hdfs://";
        InputStream in = new BufferedInputStream(new FileInputStream(localStr));
        FileSystem fs = FileSystem.get(URI.create(dst),conf);
        OutputStream out = fs.create(new Path(dst));
        IOUtils.copyBytes(in, out, 4096,true);
    } catch (Exception e) {

Please reply, urgent…

Your HDFS seem to be down. You can go to ambari and verify if every thing is up and running or not.

I can see Amabari running well.
I can goto namenode & datanode UI also.

I tries to grep the datanode & namenode tasks they are running fine.

Can you share the screenshot after logging into Ambari?


uploaded all snapshots. I am trying to run from windows machine.

Your HDFS is in maintenance mode. Remove it from maintenance mode, you will see the errors.

What is the configuration of your laptop and how much memory you have given to virtual machine?

HDFS is now not running in maintenance mode, still same error.
Laptop is having 16GB RAM & 8 is allocated to virtualbox which should be fine.
Should I run this java program from guest os by uploading jar there from windows, or is it fine it should run from windows directly.

any suggestions on above issue, I am struck on this from long time??

Your namenode might be down. It is in maintenance mode, you have to go to the service and remove it from maintenance mode.

it’s not in maintenance mode & not down also. I can see file is getting created from File Browser but no content inside.

Yes, you have to copy jar file to the guest os and run from there.