title: Hadoop 2.2 Add new Datanode to an existing hadoop installation
body: <p>I first installed hadoop 2.2 on my machine (called Abhishek-PC) and everything worked fine. I am able to run the entire system successfully. (both namenode and datanode).</p>
  
  <p>Now I created 1 VM hdclient1 and I want to add this VM as a data node. </p>
  
  <p>Here are the steps which I have followed </p>
  
  <ol>
  <li><p>I setup SSH successfully and I can ssh into hdclient1 without a password and I can login from hdclient1 into my main machine without a password.</p></li>
  <li><p>I setup hadoop 2.2 on this VM and I modified the configuration files as per many tutorials on the web. Here are my configuration files</p></li>
  </ol>
  
  <p>Name Node configuration </p>
  
  <p><a href="https://drive.google.com/file/d/0B0dV2NMSGYPXdEM1WmRqVG5uYlU/edit?usp=sharing" rel="nofollow">https://drive.google.com/file/d/0B0dV2NMSGYPXdEM1WmRqVG5uYlU/edit?usp=sharing</a></p>
  
  <p>Data Node configuration </p>
  
  <p><a href="https://drive.google.com/file/d/0B0dV2NMSGYPXRnh3YUo1X2Frams/edit?usp=sharing" rel="nofollow">https://drive.google.com/file/d/0B0dV2NMSGYPXRnh3YUo1X2Frams/edit?usp=sharing</a></p>
  
  <ol>
  <li>Now when I start start-dfs.sh on my first machine, I can see that DataNode starts successfully on hdclient1. Here is a screenshot from my hadoop console.</li>
  </ol>
  
  <p><a href="https://drive.google.com/file/d/0B0dV2NMSGYPXOEJ3UV9SV1d5bjQ/edit?usp=sharing" rel="nofollow">https://drive.google.com/file/d/0B0dV2NMSGYPXOEJ3UV9SV1d5bjQ/edit?usp=sharing</a></p>
  
  <p>As you can see both the machines appear in my cluster (main main and data node).</p>
  
  <p>Although both are called "localhost" for some strange reason.</p>
  
  <ol>
  <li>I can see that the logs are being created on hdclient1in those logs there are no exceptions.</li>
  </ol>
  
  <p>here are the logs from the name node</p>
  
  <p><a href="https://drive.google.com/file/d/0B0dV2NMSGYPXM0dZTWVRUWlGaDg/edit?usp=sharing" rel="nofollow">https://drive.google.com/file/d/0B0dV2NMSGYPXM0dZTWVRUWlGaDg/edit?usp=sharing</a></p>
  
  <p>Here are the logs from the data node</p>
  
  <p><a href="https://drive.google.com/file/d/0B0dV2NMSGYPXNV9wVmZEcUtKVXc/edit?usp=sharing" rel="nofollow">https://drive.google.com/file/d/0B0dV2NMSGYPXNV9wVmZEcUtKVXc/edit?usp=sharing</a></p>
  
  <ol>
  <li>I can login to the namenode UI successfully <code>http://Abhishek-PC:50070</code></li>
  </ol>
  
  <p>but here the UI in the live nodes it says only 1 live node and there is no mention of hdclient1.</p>
  
  <p><a href="https://drive.google.com/file/d/0B0dV2NMSGYPXZmMwM09YQlI4RzQ/edit?usp=sharing" rel="nofollow">https://drive.google.com/file/d/0B0dV2NMSGYPXZmMwM09YQlI4RzQ/edit?usp=sharing</a></p>
  
  <ol>
  <li><p>I can create a directory in hdfs successfully <code>hadoop fs -mkdir /small</code></p></li>
  <li><p>From the datanode I can see that this directory has been created by using this command <code>hadoop fs -ls /</code></p></li>
  <li><p>Now when I try to add a file to my HDFS and I say </p></li>
  </ol>
  
  <p>hadoop fs -copyFromLocal ~/Downloads/book/war_and_peace.txt /small</p>
  
  <p>i get an error message</p>
  
  <blockquote>
    <p>abhishek@Abhishek-PC:~$ hadoop fs -copyFromLocal
    ~/Downloads/book/war_and_peace.txt /small 14/01/04 20:07:41 WARN
    util.NativeCodeLoader: Unable to load native-hadoop library for your
    platform... using builtin-java classes where applicable 14/01/04
    20:07:41 WARN hdfs.DFSClient: DataStreamer Exception
    org.apache.hadoop.ipc.RemoteException(java.io.IOException): File
    /small/war_and_peace.txt.<em>COPYING</em> 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)</p>
  </blockquote>
  
  <p>So my question is What am I doing wrong here? Why do I get this exception when I try to copy the file into HDFS?</p>