简体   繁体   中英

ElasticSearch Error “/System/Volumes/Data/usr/local/var/lib/elasticsearch/nodes/0” “write” on Mac 10.15

I am trying to start elasticSearch 6.8 on Mac OS X 10.15 Catalina but it shows error. I already gives 777 permission to System/Volumes/Data/usr/local/var/lib/elasticsearch/nodes/0 folder.

  • ElasticSearch 6.8
  • OpenJDK 12

    [2019-06-24T15:12:32,803][WARN ][oebElasticsearchUncaughtExceptionHandler] [unknown] uncaught exception in thread [main] org.elasticsearch.bootstrap.StartupException: java.security.AccessControlException: access denied ("java.io.FilePermission" "/System/Volumes/Data/usr/local/var/lib/elasticsearch/nodes/0" "write") at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-6.8.1.jar:6.8.1] at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-6.8.1.jar:6.8.1] at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.8.1.jar:6.8.1] at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.8.1.jar:6.8.1] at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.8.1.jar:6.8.1] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) ~[elasticsearch-6.8.1.jar:6.8.1] at org.elasticsearch.bootstrap. Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.8.1.jar:6.8.1] Caused by: java.security.AccessControlException: access denied ("java.io.FilePermission" "/System/Volumes/Data/usr/local/var/lib/elasticsearch/nodes/0" "write") at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) ~[?:1.8.0_212] at java.security.AccessController.checkPermission(AccessController.java:884) ~[?:1.8.0_212] at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) ~[?:1.8.0_212] at java.lang.SecurityManager.checkWrite(SecurityManager.java:979) ~[?:1.8.0_212] at sun.nio.fs.UnixPath.checkWrite(UnixPath.java:801) ~[?:?] at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:376) ~[?:?] at java.nio.file.Files.createDirectory(Files.java:674) ~[?:1.8.0_212] at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) ~[?:1.8.0_212] at java.nio.file.Files.createDirectories(Files.java:727) ~[?:1.8.0_212] at org.apache.lucene.store.Nat iveFSLockFactory.obtainFSLock(NativeFSLockFactory.java:92) ~[lucene-core-7.7.0.jar:7.7.0 8c831daf4eb41153c25ddb152501ab5bae3ea3d5 - jimczi - 2019-02-04 23:16:28] at org.apache.lucene.store.FSLockFactory.obtainLock(FSLockFactory.java:41) ~[lucene-core-7.7.0.jar:7.7.0 8c831daf4eb41153c25ddb152501ab5bae3ea3d5 - jimczi - 2019-02-04 23:16:28] at org.apache.lucene.store.BaseDirectory.obtainLock(BaseDirectory.java:45) ~[lucene-core-7.7.0.jar:7.7.0 8c831daf4eb41153c25ddb152501ab5bae3ea3d5 - jimczi - 2019-02-04 23:16:28] at org.elasticsearch.env.NodeEnvironment$NodeLock.(NodeEnvironment.java:211) ~[elasticsearch-6.8.1.jar:6.8.1] at org.elasticsearch.env.NodeEnvironment.(NodeEnvironment.java:270) ~[elasticsearch-6.8.1.jar:6.8.1] at org.elasticsearch.node.Node.(Node.java:296) ~[elasticsearch-6.8.1.jar:6.8.1] at org.elasticsearch.node.Node.(Node.java:266) ~[elasticsearch-6.8.1.jar:6.8.1] at org.elasticsearch.bootstrap.Bootstrap$5.(Bootstrap.java:212) ~[elasticsearch-6.8.1.jar:6.8.1] at org.elastic search.bootstrap.Bootstrap.setup(Bootstrap.java:212) ~[elasticsearch-6.8.1.jar:6.8.1] at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.8.1.jar:6.8.1] at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-6.8.1.jar:6.8.1] ... 6 more

尝试sudo ./elsticsearch或者我认为给你的ELASTIC BASEDIR数据文件夹的权限(取决于你的安装方式)会解决它(不确定但值得一试)

Catalina symlinks /usr/local/ to some other data volume now.

Elasticsearch installed through brew creates different directory links for data and logs. You can insert the full path in the config file like this. It's because elastic search doesn't like symlinks somehow?

path.data: /System/Volumes/Data/usr/local/var/lib/elasticsearch/
path.logs: /System/Volumes/Data/usr/local/var/log/elasticsearch/

It results in another error not having access to the plugins though.

Caused by: java.security.AccessControlException: access denied ("java.io.FilePermission" "/System/Volumes/Data/usr/local/Cellar/elasticsearch-full/7.1.1/libexec/modules/percolator/percolator-client-7.1.1.jar" "read")

A workaround is to download elasticsearch manually and run from your user directory with a custom launch daemon. This worked for me.

Maybe someone else could shine some light on this.

I had the same error with ElasticSearch 2.4 and OpenJDK 8, and got it working without chmod or chown or running ES with sudo .

The solution in this comment, while not ideal (you're arguably making your java environment less secure), helped me getting it to run: https://stackoverflow.com/a/12317528

I basically added the following to my java.policy (since I had AdoptOpenJDK 8 installed, I edited that with $ sudo nano /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/security/java.policy ), inside the second grant {} block, at the end:

permission java.io.FilePermission "/System/Volumes/Data/usr/local/Cellar/elasticsearch@2.4/-", "read";
permission java.io.FilePermission "/System/Volumes/Data/usr/local/var/elasticsearch/-", "read";
permission java.io.FilePermission "/System/Volumes/Data/usr/local/var/elasticsearch/-", "write";
permission java.io.FilePermission "/System/Volumes/Data/usr/local/var/elasticsearch/-", "delete";

Note my paths and yours are slightly different (I'm on ES 2.4 and you're on 6.8, which might be related), but hopefully this helps you get unstuck.

In case you have downgrade your version of Elasticsearch, Elasticsearch is not able to understand files mades by the most recent version, so one solution is to delete the data directory (be careful it will delete all your data)

rm -rf System/Volumes/Data/usr/local/var/lib/elasticsearch/nodes

Or the other solution is to go back to your previous version (the recent one)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM