title: There are 0 datanode(s) running and no node(s) are excluded in this operation
body: <p>I have set up a multi node Hadoop Cluster. The NameNode and Secondary namenode runs on the same machine and the cluster has only one Datanode. All the nodes are configured on Amazon EC2 machines.</p>
  
  <h3>Following are the configuration files on the master node:</h3>
  
  <pre><code>masters
  54.68.218.192 (public IP of the master node)
  
  slaves
  54.68.169.62 (public IP of the slave node)
  </code></pre>
  
  <p>core-site.xml</p>
  
  <pre><code>&lt;configuration&gt;
  &lt;property&gt;
  &lt;name&gt;fs.default.name&lt;/name&gt;
  &lt;value&gt;hdfs://localhost:9000&lt;/value&gt;
  &lt;/property&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>mapred-site.xml</p>
  
  <pre><code>&lt;configuration&gt;
  &lt;property&gt;
  &lt;name&gt;mapreduce.framework.name&lt;/name&gt;
  &lt;value&gt;yarn&lt;/value&gt;
  &lt;/property&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>hdfs-site.xml</p>
  
  <pre><code>&lt;configuration&gt;
  &lt;property&gt;
  &lt;name&gt;dfs.replication&lt;/name&gt;
  &lt;value&gt;1&lt;/value&gt;
  &lt;/property&gt;
  &lt;property&gt;
  &lt;name&gt;dfs.namenode.name.dir&lt;/name&gt;
  &lt;value&gt;file:/usr/local/hadoop_store/hdfs/namenode&lt;/value&gt;
  &lt;/property&gt;
  &lt;property&gt;
  &lt;name&gt;dfs.datanode.name.dir&lt;/name&gt;
  &lt;value&gt;file:/usr/local/hadoop_store/hdfs/datanode&lt;/value&gt;
  &lt;/property&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <h3>Now are the configuration files on the datanode:</h3>
  
  <p>core-site.xml</p>
  
  <pre><code>&lt;configuration&gt;
  &lt;property&gt;
  &lt;name&gt;fs.default.name&lt;/name&gt;
  &lt;value&gt;hdfs://54.68.218.192:10001&lt;/value&gt;
  &lt;/property&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>mapred-site.xml</p>
  
  <pre><code>&lt;configuration&gt;
  &lt;property&gt;
  &lt;name&gt;mapred.job.tracker&lt;/name&gt;
  &lt;value&gt;54.68.218.192:10002&lt;/value&gt;
  &lt;/property&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>hdfs-site.xml</p>
  
  <pre><code>&lt;configuration&gt;
  &lt;property&gt;
  &lt;name&gt;dfs.replication&lt;/name&gt;
  &lt;value&gt;1&lt;/value&gt;
  &lt;/property&gt;
  &lt;property&gt;
  &lt;name&gt;dfs.namenode.name.dir&lt;/name&gt;
  &lt;value&gt;file:/usr/local/hadoop_store/hdfs/namenode&lt;/value&gt;
  &lt;/property&gt;
  &lt;property&gt;
  &lt;name&gt;dfs.datanode.name.dir&lt;/name&gt;
  &lt;value&gt;file:/usr/local/hadoop_store/hdfs/datanode&lt;/value&gt;
  &lt;/property&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>the jps run on the Namenode give the following:</p>
  
  <pre><code>5696 NameNode
  6504 Jps
  5905 SecondaryNameNode
  6040 ResourceManager
  </code></pre>
  
  <p>and jps on datanode:</p>
  
  <pre><code>2883 DataNode
  3496 Jps
  3381 NodeManager
  </code></pre>
  
  <p>which to me seems right.</p>
  
  <p>Now when I try to run a put command:</p>
  
  <pre><code>hadoop fs -put count_inputfile /test/input/
  </code></pre>
  
  <p>It gives me the following error:</p>
  
  <pre><code>put: File /count_inputfile._COPYING_ could only be replicated to 0 nodes instead of minReplication (=1).  There are 0 datanode(s) running and no node(s) are excluded in this operation.
  </code></pre>
  
  <p>The logs on the datanode says the following:</p>
  
  <pre><code>hadoop-datanode log
  INFO org.apache.hadoop.ipc.Client: Retrying connect to server:      54.68.218.192/54.68.218.192:10001. Already tried 8 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
  </code></pre>
  
  <p>yarn-nodemanager log:</p>
  
  <pre><code>INFO org.apache.hadoop.ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8031. Already tried 9 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
  </code></pre>
  
  <p>The web UI of node manager(50070) shows that there are 0 live nodes and 0 dead nodes and the dfs used is 100%</p>
  
  <p><strong>I have also disabled IPV6.</strong></p>
  
  <p>On a few websites I found out that I should also edit the <code>/etc/hosts</code> file. I have also edited them and they look like this:</p>
  
  <pre><code>127.0.0.1 localhost
  172.31.25.151 ip-172-31-25-151.us-west-2.compute.internal
  172.31.25.152 ip-172-31-25-152.us-west-2.compute.internal
  </code></pre>
  
  <p>Why I am still geting the error?</p>