es启动报RuntimeException: can not run elasticsearch as root解决方法

Posted 秋9

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了es启动报RuntimeException: can not run elasticsearch as root解决方法相关的知识,希望对你有一定的参考价值。

【现象】

[root@i-o7bjq736 bin]# ./elasticsearch
[2021-07-06T11:36:12,624][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [i-o7bjq736] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:174) ~[elasticsearch-7.9.3.jar:7.9.3]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161) ~[elasticsearch-7.9.3.jar:7.9.3]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.9.3.jar:7.9.3]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127) ~[elasticsearch-cli-7.9.3.jar:7.9.3]
        at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.9.3.jar:7.9.3]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126) ~[elasticsearch-7.9.3.jar:7.9.3]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.9.3.jar:7.9.3]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:111) ~[elasticsearch-7.9.3.jar:7.9.3]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:178) ~[elasticsearch-7.9.3.jar:7.9.3]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:393) ~[elasticsearch-7.9.3.jar:7.9.3]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170) ~[elasticsearch-7.9.3.jar:7.9.3]
        ... 6 more
uncaught exception in thread [main]
java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:111)
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:178)
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:393)
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170)
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161)
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)
        at org.elasticsearch.cli.Command.main(Command.java:90)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92)
For complete error details, refer to the log at /opt/apps/es/elasticsearch/logs/elasticsearch.log
[root@i-o7bjq736 bin]# 2021-07-06 03:36:12,949778 UTC [3493] ERROR CLogger.cc@310 Cannot log to named pipe /tmp/elasticsearch-15611083902663471733/controller_log_3299 as it could not be opened for writing
2021-07-06 03:36:12,949848 UTC [3493] INFO  Main.cc@103 Parent process died - ML controller exiting

【解决方法】

su es
cd /opt/apps/es/elasticsearch/bin
./elasticsearch

其中es是安装elasticsearch时创建的用户

以上是关于es启动报RuntimeException: can not run elasticsearch as root解决方法的主要内容,如果未能解决你的问题,请参考以下文章

sonar6.7.2启动报错

SpringBoot项目启动报错:java.lang.RuntimeException: java.lang.reflect.InvocationTargetException

java.lang.RuntimeException: HRegionServer Aborted

es启动报错BindException: Can't assign requested address

es启动报AccessDeniedException: /opt/apps/es/elasticsearch/config/elasticsearch.keystore解决方法

es启动报AccessDeniedException: /opt/apps/es/elasticsearch/config/elasticsearch.keystore解决方法