java 如何解决elasticsearch中的AccessDeniedException?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34564625/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to solve AccessDeniedException in elasticsearch?
提问by Hyman Moscovi
Currently I have two accounts on mac, one is the original and the other one is the newly created both are admin type
目前我在mac上有两个账号,一个是原来的,一个是新建的,都是admin类型的
Original account name is = Hyman
Newly created is = Snooke
In Hyman account when I type in elasticsearch
on the terminal its working fine
当我在elasticsearch
终端上输入时,在 Hyman 帐户中它工作正常
But when i type elasticsearch
on Snooke's terminal I received this error
但是当我elasticsearch
在 Snooke 的终端上输入时,我收到了这个错误
Exception in thread "main" java.lang.IllegalStateException: Failed to created node environment
Likely root cause: java.nio.file.AccessDeniedException: /usr/local/var/elasticsearch/elasticsearch_Hyman/nodes/1
It seems like Snooke is trying to access Hyman's elastic search folder?
似乎 Snooke 正在尝试访问 Hyman 的弹性搜索文件夹?
How do I solve this?
我该如何解决这个问题?
回答by Jettro Coenradie
On my Mac users with admin rights are in the group staff. Problem is that elasticsearch writes folders in the data folder with the rights r-x. So other members of the group do not have write access to these folders. You could change these access rights for all the folders by doing some like chmod -R 775. But I think that with every new folder that is created you would face the same problems.
在我的 Mac 上,具有管理员权限的用户在组员工中。问题是 elasticsearch 使用权限rx在数据文件夹中写入文件夹。因此该组的其他成员没有对这些文件夹的写访问权限。您可以通过执行诸如 chmod -R 775 之类的操作来更改所有文件夹的这些访问权限。但我认为对于创建的每个新文件夹,您都会面临相同的问题。
This problem is only there if you want keep using the data with both accounts. If you just want to use the new account you could go to the elasticsearch folder and do: (Notice the '.' at the end)
只有当您想继续使用两个帐户的数据时才会出现此问题。如果您只想使用新帐户,您可以转到 elasticsearch 文件夹并执行以下操作:(注意末尾的“.”)
chown -R Snooke:staff .