标签:
在Linux上部署ElasticSearch时抛出了一个异常如下:
log4j:ERROR setFile(null,true) call failed. java.io.FileNotFoundException: /usr/local/elasticsearch/logs/elasticsearch.log at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.<init>(FileOutputStream.java:221) at java.io.FileOutputStream.<init>(FileOutputStream.java:142) at org.apache.log4j.FileAppender.setFile(FileAppender.java:294) at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165) at org.apache.log4j.DailyRollingFileAppender.activateOptions(DailyRollingFileAppender.java:223) at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:172) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:104) at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:842) at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768) at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:648) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:514) at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:440) at org.elasticsearch.common.logging.log4j.LogConfigurator.configure(LogConfigurator.java:128) at org.elasticsearch.bootstrap.Bootstrap.setupLogging(Bootstrap.java:204) at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:258) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
以为自己权限不够,使用sudo运行,仍旧抛出如下错误:
Exception in thread "main" java.lang.RuntimeException: don‘t run elasticsearch as root. at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:93) at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:144) at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35) Refer to the log for complete error details.
将ElasticSearch的安装目录及其子目录改为另外一个非root账户,如:
sudo chown -R guest elasticsearch-2.4.0 sudo chgrp -R guest elasticsearch-2.4.0
由于ElasticSearch可以接收用户的脚本并执行,处于安全性考虑,建议创建一个单独的用户来运行ElasticSearch。
Elasticsearch部署异常Permission denied
标签:
原文地址:http://www.cnblogs.com/krockey/p/5850141.html