Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Elasticsearch 2.1.1 as root user in Linux machine

Tags:

I am trying to run Elasticsearch 2.1.1 in my Linux machine which I am the root user of it.

When I tried to execute the Elasticsearch.I am getting the following error:

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. 

I referred some suggestion available in internet, they mentioned to run it as different user. My scenario is to run as root user only. How to overcome this problem without running as different user.

like image 590
Mangoski Avatar asked Jan 21 '16 10:01

Mangoski


People also ask

How do I start root in elasticsearch?

Step 1: Pull images of elastic search from Docker/install from web. Step 2: Execute Docker-Exec command to get location on Bash. Step 3: vi bin/elasticsearch.

What is $Es_home?

ES_HOME is an environment variable pointing where Elasticsearch is installed. If no other settings are specified, Elasticsearch operates solely out of this directory. Open up a shell and set this all important variable: export ES_HOME=/usr/share/elasticsearch.


2 Answers

Based of the following code-snippet looks like you should be able to achieve this by enabling property es.insecure.allow.root

Example :

bin/elasticsearch -Des.insecure.allow.root=true 
like image 72
keety Avatar answered Sep 17 '22 03:09

keety


  1. Open script file:

    vi bin/elasticsearch

  2. Add property for allow root:

    ES_JAVA_OPTS="-Des.insecure.allow.root=true"

  3. Save and close.
  4. You can start by root now.

Good luck.

like image 32
Viet Tran Avatar answered Sep 17 '22 03:09

Viet Tran