在docker上安装ELK

时间:2018-09-07 11:36:54

标签: docker elastic-stack

我使用以下命令从here中提取了ELK容器:

sudo docker run -p 5601:5601 -p 9200:9200 -p 5044:5044 -it --name elk sebp/elk

它运行出色,但是如果没有我的logstash和elasticsearch配置,我不能使用它吗?所以我取消了服务并添加了配置。我将用户更改为名为elk:elk的新用户。现在,当我尝试启动elasticsearch时,它失败,并带有以下异常:

Exception in thread "main" org.elasticsearch.bootstrap.BootstrapException: java.nio.file.AccessDeniedException: /etc/elasticsearch/elasticsearch.keystore
Likely root cause: java.nio.file.AccessDeniedException: /etc/elasticsearch/elasticsearch.keystore
        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.newByteChannel(UnixFileSystemProvider.java:214)
        at java.nio.file.Files.newByteChannel(Files.java:361)
        at java.nio.file.Files.newByteChannel(Files.java:407)
        at org.apache.lucene.store.SimpleFSDirectory.openInput(SimpleFSDirectory.java:77)
        at org.elasticsearch.common.settings.KeyStoreWrapper.load(KeyStoreWrapper.java:207)
        at org.elasticsearch.bootstrap.Bootstrap.loadSecureSettings(Bootstrap.java:226)
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:291)
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136)
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127)
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124)
        at org.elasticsearch.cli.Command.main(Command.java:90)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86)
Refer to the log for complete error details.

2 个答案:

答案 0 :(得分:0)

github上有一个针对此错误的开放问题,https://github.com/elastic/ansible-elasticsearch/issues/430

elasticsearch尝试在版本6.x中的配置目录中写入和读取。 当前的解决方法是将权限明确设置为g+ws, 即

chmod g+ws /etc/elasticsearch

答案 1 :(得分:0)

可能您需要设置密钥库文件的适当所有权和权限。

# chown elasticsearch:elasticsearch /etc/elasticsearch/elasticsearch.keystore
# chmod 600 /etc/elasticsearch/elasticsearch.keystore