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.
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.
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.
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
Open script file:
vi bin/elasticsearch
Add property for allow root:
ES_JAVA_OPTS="-Des.insecure.allow.root=true"
Good luck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With