ElasticSearch错误 - 卷曲:(7)连接到localhost失败:9200;拒绝连接

时间:2017-06-14 18:02:44

标签: curl elasticsearch server

我正在尝试为greylog安装elasticsearch,我已经安装了java并且在我的elasticSearch.yml文件中我更改了这些:

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

所有其他人都有评论。但是当我运行命令时

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

我收到了这个错误:

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

可能是什么问题?

我明白了:

[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

1 个答案:

答案 0 :(得分:2)

看起来你无法写入数据目录,因此节点无法启动。

你是否有机会在Docker中运行它并且没有设置正确的权限?这是导致此错误的最常见原因。