当前位置: 代码迷 >> 综合 >> java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/nodes
  详细解决方案

java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/nodes

热度:62   发布时间:2023-12-12 11:31:40.0

启动ES报错

"Caused by: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/nodes",
"at sun.nio.fs.UnixException.translateToIOException(UnixException.java:90) ~[?:?]",
"at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106) ~[?:?]",
"at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) ~[?:?]",
"at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:398) ~[?:?]",
"at java.nio.file.Files.createDirectory(Files.java:700) ~[?:?]",
"at java.nio.file.Files.createAndCheckIsDirectory(Files.java:807) ~[?:?]",
"at java.nio.file.Files.createDirectories(Files.java:793) ~[?:?]",
"at org.elasticsearch.env.NodeEnvironment.lambda$new$0(NodeEnvironment.java:265) ~[elasticsearch-7.15.1.jar:7.15.1]",
"at org.elasticsearch.env.NodeEnvironment$NodeLock.<init>(NodeEnvironment.java:202) ~[elasticsearch-7.15.1.jar:7.15.1]",
"at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:262) ~[elasticsearch-7.15.1.jar:7.15.1]",
"at org.elasticsearch.node.Node.<init>(Node.java:383) ~[elasticsearch-7.15.1.jar:7.15.1]",
"at org.elasticsearch.node.Node.<init>(Node.java:288) ~[elasticsearch-7.15.1.jar:7.15.1]",
"at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:219) ~[elasticsearch-7.15.1.jar:7.15.1]",
"at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:219) ~[elasticsearch-7.15.1.jar:7.15.1]",
"at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:399) ~[elasticsearch-7.15.1.jar:7.15.1]",
"at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:167) ~[elasticsearch-7.15.1.jar:7.15.1]",
"... 6 more"] }
uncaught exception in thread [main]
ElasticsearchException[failed to bind service]; nested: AccessDeniedException[/usr/share/elasticsearch/data/nodes];
Likely root cause: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/nodesat 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.createDirectory(UnixFileSystemProvider.java:398)at java.base/java.nio.file.Files.createDirectory(Files.java:700)at java.base/java.nio.file.Files.createAndCheckIsDirectory(Files.java:807)at java.base/java.nio.file.Files.createDirectories(Files.java:793)at org.elasticsearch.env.NodeEnvironment.lambda$new$0(NodeEnvironment.java:265)at org.elasticsearch.env.NodeEnvironment$NodeLock.<init>(NodeEnvironment.java:202)at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:262)at org.elasticsearch.node.Node.<init>(Node.java:383)at org.elasticsearch.node.Node.<init>(Node.java:288)at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:219)at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:219)at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:399)at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:167)at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:158)at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:75)at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:114)at org.elasticsearch.cli.Command.main(Command.java:79)at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:123)at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:81)

错误原因

挂载的目录权限不足
这里挂载了两个目录

chmod 777 data
chmod 777 plugins
docker restart elasticsearch
  相关解决方案