elasticsearch启动报错:can not run elasticsearch as root

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/ES/elasticsearch-7.10.2/logs/elasticsearch.log
[root@localhost bin]# 2023-04-25 17:46:54,138823 UTC [5722] INFO Main.cc@103 Parent process died - ML controller exiting

原因是elasticsearch为了安全,不允许使用root用户启动,由于ElasticSearch可以接收用户输入的脚本并且执行,为了系统安全考虑,需要创建一个单独的用户用来运行ElasticSearch。

 

下面是具体步骤:

创建用户组和用户

 

groupadd elsearch
useradd elsearch -g elsearch -p codingwhy

更改 elasticsearch-6.5.2 文件夹及内部文件的所属用户及组为elsearch

 chown -R elsearch:elsearch elasticsearch-7.10.2

 

切换用户并启动 elasticsearch

su elsearch
./elasticsearch

通过以上方法,就能正常启动elasticsearch了。

 
 
Kibana授权
chown es:es /opt/kibana/kibana-7.17.10-linux-x86_64

 

posted @ 2023-04-26 02:05  爵士灬  阅读(496)  评论(0编辑  收藏  举报