How to run Elasticsearch as root user in Linux machine

0 votes

Hi Guys,

I am trying to run the ElasticSearch server. But I am getting the below error.

[2020-06-18T13:49:48,487][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [localhost.localdomain] 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:174) ~[elasticsearch-7.7.1.jar:7.7.1]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161) ~[elasticsearch-7.7.1.jar:7.7.1]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.7.1.jar:7.7.1]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127) ~[elasticsearch-cli-7.7.1.jar:7.7.1]
        at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.7.1.jar:7.7.1]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126) ~[elasticsearch-7.7.1.jar:7.7.1]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.7.1.jar:7.7.1]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:111) ~[elasticsearch-7.7.1.jar:7.7.1]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:178) ~[elasticsearch-7.7.1.jar:7.7.1]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:393) ~[elasticsearch-7.7.1.jar:7.7.1]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170) ~[elasticsearch-7.7.1.jar:7.7.1]
        ... 6 more
Jun 19, 2020 in ELK Stack by akhtar
• 38,260 points
7,544 views

2 answers to this question.

0 votes

Hi@akhtar,

By default, ElasticSearch will not work with the root user.  But you can change configuration dynamically. you should be able to achieve this by enabling property -Des.insecure.allow.root

bin/elasticsearch -Des.insecure.allow.root=true

I hope this will solve your error.

answered Jun 19, 2020 by MD
• 95,460 points
+1 vote

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.

Step 4: Add Property to allow on root. ES_JAVA_OPTS="-Des.insecure.allow.root=true"

Step 5: Save and Close

answered Jun 19, 2020 by PAWAN
• 380 points

Related Questions In ELK Stack

0 votes
1 answer

How to install Elasticsearch tool in Linux System ?

Hi@akhtar, You can follow the below-given steps to ...READ MORE

answered Jun 19, 2020 in ELK Stack by MD
• 95,460 points
916 views
0 votes
1 answer

java.lang.RuntimeException: can not run elasticsearch as root

Hi@akhtar, ElasticSearch will not require root privilege to ...READ MORE

answered Jun 19, 2020 in ELK Stack by MD
• 95,460 points
20,058 views
0 votes
1 answer

How to install Kibana in Linux system?

Hi@akhtar, You can follow the below-given steps to ...READ MORE

answered Jun 19, 2020 in ELK Stack by MD
• 95,460 points
1,012 views
0 votes
1 answer

How to integrate Logstash with ElasticSearch?

Hi@akhtar, You can use elasticsearch plugin to integrate ...READ MORE

answered Jun 19, 2020 in ELK Stack by MD
• 95,460 points
1,153 views
0 votes
1 answer

How to change hostname in Kibana?

Hi@akhtar, You can change the hostname of your ...READ MORE

answered Jun 19, 2020 in ELK Stack by MD
• 95,460 points
4,341 views
0 votes
1 answer

bash: cd: root/elasticsearch/: Permission denied

Hi@akhtar, You need to set permission for elasticsearch ...READ MORE

answered Jun 19, 2020 in ELK Stack by MD
• 95,460 points
4,749 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,941 views
+2 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP