Search for elasticity as root

Im getting below the error when I tried to start searching for elastic results 5.0 with the ./elasticsearch and below the error.

 [2016-11-23T13:44:09,507][WARN ][oebElasticsearchUncaughtExceptionHandler] [] 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:116) ~[elasticsearch-5.0.1.jar:5.0.1] at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:103) ~[elasticsearch-5.0.1.jar:5.0.1] at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54) ~[elasticsearch-5.0.1.jar:5.0.1] at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:96) ~[elasticsearch-5.0.1.jar:5.0.1] at org.elasticsearch.cli.Command.main(Command.java:62) ~[elasticsearch-5.0.1.jar:5.0.1] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) ~[elasticsearch-5.0.1.jar:5.0.1] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73) ~[elasticsearch-5.0.1.jar:5.0.1] Caused by: java.lang.RuntimeException: can not run elasticsearch as root at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:96) ~[elasticsearch-5.0.1.jar:5.0.1] at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:155) ~[elasticsearch-5.0.1.jar:5.0.1] at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286) ~[elasticsearch-5.0.1.jar:5.0.1] at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:112) ~[elasticsearch-5.0.1.jar:5.0.1] ... 6 more 

I tried to start by switching to another user and tried sudo ./elasticsearch and got the same error. How to start elasticity search as root user?

+6
source share
4 answers

You cannot run elasticsearch as root. This is not allowed and is very dangerous.

Read the installation guide to understand how to properly install it depending on your host.

+1
source

The root cause of this problem is: ElasticSearch is not allowed to run from the root owner. There is another possibility for this problem: "The Java path is set for the root user, not only for all other users." The solution to this problem:

Step 1: Change the ownership of the elasticSearch directory from root to another user at the command. $ sudo chown -R current_User: Group_Name elasticsearch-5.5.0

Setp 2: Check Java installed in the classpath for the current user [not just root]. If the command: $ java -version or echo $ The JAVA_HOME command gives an empty result. This means that we must install Java in the classpath [system env varible] for the current user, and then perform step 3. otherwise, start the elasticsearch service.

Step 3: edit / etc / profile and add two lines according to your system. export JAVA_HOME = "Location of Java dir"

export PATH = $ JAVA_HOME / bin: $ PATH Running $ source source / etc / profile

After that, the flexibleSearch service starts. It worked great for me.

+2
source

I had the same problem and had to contact another user. But first, I had to give him permission to perform a bin / elastics search.

+1
source

This was previously set for ES2 ( How to start Elasticsearch 2.1.1 as root user in a Linux machine )

The same solution can work at 5.

As stated earlier, you probably shouldn't do this.

-one
source

Source: https://habr.com/ru/post/1012589/


All Articles