title: ElasticSearch error - curl: (7) Failed connect to localhost:9200; Connection refused
body: <p>I am trying to install elasticsearch for greylog, I have installed java and inside my elasticSearch.yml file I changed these:</p>
  
  <pre><code>cluster.name:graylog
  node.name: "node-1"
  network.host: 0.0.0.0
  network.bind_host: localhost
  network.publish_host: 0.0.0.0
  script.inline: false
  script.indexed: false
  script.file: false
  </code></pre>
  
  <p>All others are comment. But when I run the command </p>
  
  <pre><code>curl -X GET 'http://localhost:9200'
  </code></pre>
  
  <p>I got this error: </p>
  
  <pre><code>curl: (7) Failed connect to localhost:9200; Connection refused
  </code></pre>
  
  <p>What could be the problem ??</p>
  
  <p>I got this:</p>
  
  <pre><code>[2017-06-14 15:37:18,717][ERROR][bootstrap                ] Exception
  java.lang.IllegalStateException: Failed to created node environment
          at org.elasticsearch.node.Node.&lt;init&gt;(Node.java:167)
          at org.elasticsearch.node.Node.&lt;init&gt;(Node.java:140)
          at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:143)
          at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:194)
          at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286)
          at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:45)
  Caused by: java.nio.file.AccessDeniedException: 
  /var/lib/elasticsearch/graylog/nodes/0
      at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
      at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
      at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
      at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384)
      at java.nio.file.Files.createDirectory(Files.java:674)
      at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781)
      at java.nio.file.Files.createDirectories(Files.java:767)
      at org.elasticsearch.env.NodeEnvironment.&lt;init&gt;(NodeEnvironment.java:169)
      at org.elasticsearch.node.Node.&lt;init&gt;(Node.java:165)
      ... 5 more
  </code></pre>