Elasticsaerch啟動報錯:Exception in thread "main" java.nio.file.AccessDeniedException:
./elasticsearch
然後返回錯誤Exception in thread "main" java.nio.file.AccessDeniedException: /root/home/searchengine/elasticsearch-6.2.4/config/jvm.options 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 java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384) at java.nio.file.Files.newInputStream(Files.java:152) at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:58)
錯誤原因:使用非 root使用者啟動ES,而該使用者的檔案許可權不足而被拒絕執行。
解決方法: chown -R 使用者名稱:使用者名稱 檔案(目錄)名
例如: chown -R abc:abc searchengine
再啟動ES就正常了
[2018-06-12T10:37:04,630][INFO ][o.e.n.Node ] [inforsearch] initialized
[2018-06-12T10:37:04,630][INFO ][o.e.n.Node ] [inforsearch] starting ...