org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-6.8.9.jar:6.8.9] at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-6.8.9.jar:6.8.9] at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.8.9.jar:6.8.9] at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.8.9.jar:6.8.9] at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.8.9.jar:6.8.9] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) ~[elasticsearch-6.8.9.jar:6.8.9] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.8.9.jar:6.8.9] Caused by: java.lang.RuntimeException: can not run elasticsearch as root at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:103) ~[elasticsearch-6.8.9.jar:6.8.9] at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170) ~[elasticsearch-6.8.9.jar:6.8.9] at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.8.9.jar:6.8.9] at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-6.8.9.jar:6.8.9] ... 6 more解决方法有两类:
1、修改elaticsearch配置,使其可以允许root用户启动(不建议)
#在执行elasticSearch时加上参数-Des.insecure.allow.root=true,完整命令如下 ./elasticsearch -Des.insecure.allow.root=true #或者 用vi打开elasicsearch执行文件,在变量ES_JAVA_OPTS使用前添加以下命令 ES_JAVA_OPTS="-Des.insecure.allow.root=true"
2、为elaticsearch创建用户并赋予相应权限
命令如下 具体介绍参考我的另一篇博客linux创建新用户并将为其赋予权限
adduser es passwd es chown -R es:es elasticsearch-6.8.9/ chmod 770 elasticsearch-6.8.9/
这个意思是ES不能使用root用户启动,只能通过建立其它用户来启动,可以建立一个es用户来启动:
useradd es su es
切换回来后再启动es即可
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)