AccessDeniedException: /opt/elasticsearch-7.0.0/config/elasticsearch.keystore

[elastic@node2 elasticsearch-7.0.0]$ bin/elasticsearch
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Exception in thread "main" org.elasticsearch.bootstrap.BootstrapException: java.nio.file.AccessDeniedException: /opt/elasticsearch-7.0.0/config/elasticsearch.keystore
Likely root cause: java.nio.file.AccessDeniedException: /opt/elasticsearch-7.0.0/config/elasticsearch.keystore
	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
	at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
	at java.base/java.nio.file.Files.newByteChannel(Files.java:373)
	at java.base/java.nio.file.Files.newByteChannel(Files.java:424)
	at org.apache.lucene.store.SimpleFSDirectory.openInput(SimpleFSDirectory.java:77)
	at org.elasticsearch.common.settings.KeyStoreWrapper.load(KeyStoreWrapper.java:215)
	at org.elasticsearch.bootstrap.Bootstrap.loadSecureSettings(Bootstrap.java:224)
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:289)
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159)
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150)
	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:115)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92)
Refer to the log for complete error details.
[elastic@node2 elasticsearch-7.0.0]$

查找原因,elasticsearch.keystore的宿主是root

[elastic@node2 elasticsearch-7.0.0]$ ll config/
total 40
-rw-rw---- 1 root    root      207 May  5 02:28 elasticsearch.keystore
-rw-rw---- 1 elastic elastic  2841 May  5 02:33 elasticsearch.yml
-rw-rw---- 1 elastic elastic  3524 May  5 02:25 jvm.options
-rw-rw---- 1 elastic elastic 17170 May  5 02:25 log4j2.properties
-rw-rw---- 1 elastic elastic   473 May  5 02:25 role_mapping.yml
-rw-rw---- 1 elastic elastic   197 May  5 02:25 roles.yml
-rw-rw---- 1 elastic elastic     0 May  5 02:25 users
-rw-rw---- 1 elastic elastic     0 May  5 02:25 users_roles
[elastic@node2 elasticsearch-7.0.0]$

重新更改宿主

[elastic@node3 elasticsearch-7.0.0]$ su root
Password: 
[root@node3 elasticsearch-7.0.0]# chown -R elastic:elastic /opt/elasticsearch-7.0.0
[root@node3 elasticsearch-7.0.0]# 

你可能感兴趣的:(Elasticsearch,7.x学习笔记)