starry1990
starry1990

Reputation: 121

ElasticSearch error - curl: (7) Failed connect to localhost:9200; Connection refused

I am trying to install elasticsearch for greylog, I have installed java and inside my elasticSearch.yml file I changed these:

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

All others are comment. But when I run the command

curl -X GET 'http://localhost:9200'

I got this error:

curl: (7) Failed connect to localhost:9200; Connection refused

What could be the problem ??

I got this:

[2017-06-14 15:37:18,717][ERROR][bootstrap                ] Exception
java.lang.IllegalStateException: Failed to created node environment
        at org.elasticsearch.node.Node.<init>(Node.java:167)
        at org.elasticsearch.node.Node.<init>(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.<init>(NodeEnvironment.java:169)
    at org.elasticsearch.node.Node.<init>(Node.java:165)
    ... 5 more

Upvotes: 1

Views: 5286

Answers (1)

xeraa
xeraa

Reputation: 10859

Looks like you cannot write to the data directory thus the node does not start up.

Do you run this in Docker by any chance and haven't set the right permissions? That's the most common cause of this error.

Upvotes: 2

Related Questions