es启动报AccessDeniedException: /opt/apps/es/elasticsearch/config/elasticsearch.keystore解决方法

Posted 秋9

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了es启动报AccessDeniedException: /opt/apps/es/elasticsearch/config/elasticsearch.keystore解决方法相关的知识,希望对你有一定的参考价值。

【现象】

[es@i-o7bjq736 bin]$ ./elasticsearch
Exception in thread "main" java.nio.file.AccessDeniedException: /opt/apps/es/elasticsearch/config/elasticsearch.keystore
        at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
        at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218)
        at java.base/java.nio.file.Files.newByteChannel(Files.java:375)
        at java.base/java.nio.file.Files.newByteChannel(Files.java:426)
        at org.apache.lucene.store.SimpleFSDirectory.openInput(SimpleFSDirectory.java:79)
        at org.elasticsearch.common.settings.KeyStoreWrapper.load(KeyStoreWrapper.java:220)
        at org.elasticsearch.common.settings.HasPasswordKeyStoreCommand.execute(HasPasswordKeyStoreCommand.java:42)
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)
        at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:91)
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)
        at org.elasticsearch.cli.Command.main(Command.java:90)
        at org.elasticsearch.common.settings.KeyStoreCli.main(KeyStoreCli.java:43)
Exception in thread "main" org.elasticsearch.bootstrap.BootstrapException: java.nio.file.AccessDeniedException: /opt/apps/es/elasticsearch/config/elasticsearch.keystore
Likely root cause: java.nio.file.AccessDeniedException: /opt/apps/es/elasticsearch/config/elasticsearch.keystore
        at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
        at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218)
        at java.base/java.nio.file.Files.newByteChannel(Files.java:375)
        at java.base/java.nio.file.Files.newByteChannel(Files.java:426)
        at org.apache.lucene.store.SimpleFSDirectory.openInput(SimpleFSDirectory.java:79)
        at org.elasticsearch.common.settings.KeyStoreWrapper.load(KeyStoreWrapper.java:220)
        at org.elasticsearch.bootstrap.Bootstrap.loadSecureSettings(Bootstrap.java:240)
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:349)
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170)
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161)
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)
        at org.elasticsearch.cli.Command.main(Command.java:90)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92)
[es@i-o7bjq736 bin]$

【解决方法】

使用root账号,执行如下命令:

cd /opt/apps/es/elasticsearch/config
chown -R es:esg  elasticsearch.keystore

其中es:esg中es是用户,esg是用户组

以上是关于es启动报AccessDeniedException: /opt/apps/es/elasticsearch/config/elasticsearch.keystore解决方法的主要内容,如果未能解决你的问题,请参考以下文章

es启动报AccessDeniedException: /opt/apps/es/elasticsearch/config/elasticsearch.keystore解决方法

es7.8启动报错 说是主节点没找到

es启动报RuntimeException: can not run elasticsearch as root解决方法

es启动报RuntimeException: can not run elasticsearch as root解决方法

ES启动闪退报错

Kibana 最常见的“启动报错”或“无法连接ES集群服务”的故障原因及解决方案汇总