title: unable to connect to hdfs on localhost
body: <p>I am unable to connect to hdfs on port 9000, I keep getting this error:</p>
  
  <pre><code>localhost:8020 failed on connection exception: java.net.ConnectException: Connection refused
  </code></pre>
  
  <p>hdfs-site.xml file is this:</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/hdfs/namenode&lt;/value&gt;
       &lt;/property&gt;
       &lt;property&gt;
              &lt;name&gt;dfs.datanode.data.dir&lt;/name&gt;
              &lt;value&gt;file:/usr/localhdfs/datanode&lt;/value&gt;
       &lt;/property&gt;
       &lt;property&gt;
          &lt;name&gt;dfs.webhdfs.enabled&lt;/name&gt;
          &lt;value&gt;true&lt;/value&gt;
       &lt;/property&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;property&gt;
          &lt;name&gt;dfs.namenode.rpc-bind-host&lt;/name&gt;
          &lt;value&gt;0.0.0.0&lt;/value&gt;
       &lt;/property&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>and core-site.xml file is this:</p>
  
  <pre><code>&lt;configuration&gt;
    &lt;property&gt;
          &lt;name&gt;fs.defaultFS&lt;/name&gt;
          &lt;value&gt;hdfs://localhost:9000&lt;/value&gt;
    &lt;/property&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I have restarted the cluster multiple times, I keep getting connection errors:</p>
  
  <p>this is my /etc/hosts file look like:</p>
  
  <pre><code>127.0.0.1   localhost
  </code></pre>
  
  <p>what am I missing?</p>