Hello,
after the installation of elasticsearch_7.3.1, i've got the message "can not run elasticsearch as root".
I had a functionnal 1.7.3 with some changes :
-/etc/default/elasticsearch => uncommented lines START_DAEMON=true, ES_USER=elasticsearch, ES_GROUP=elasticsearch
-/etc/elasticsearch/elasticsearch.yml => host 0.0.0.0, port :9200
My variable JAVA_HOME = /usr/lib/jvm/java-8-openjdk-amd64
I've Ubuntu 16.04
and direclty run elasticsearch from ./bin/elasticsearch from the folder on the desktop
Hello, thanks for the answer;
i checked, and i've not elasticsearch in /etc/ so i can't find the file /dir permission.
/usr/share/elastocsearch apparently references to my old version :
[2019-08-23 14:57:25,722][INFO ][node ] [My First Node] version[1.7.3], pid[29564], build[NA/NA]
[2019-08-23 14:57:34,975][INFO ][cluster.service ] [My First Node] new_master [My First Node][JliEcoAeSH-65EC_bMl8Pg][dejancourt-VirtualBox][inet[/10.0.2.15:9301]], reason: zen-disco-join (elected_as_master)
[2019-08-23 14:57:35,111][ERROR][bootstrap ] [My First Node] Exception$
org.elasticsearch.http.BindHttpException: Failed to bind to [9200]$
and in the logs of the app i can find this :
pwd
/home/dejancourt/Bureau/elasticsearch-7.3.1/logs
cat -A logs/elasticsearch.log
[2019-08-26T16:09:01,670][ERROR][o.e.b.Bootstrap ] [dejancourt-VirtualBox] Exception$
java.lang.RuntimeException: can not run elasticsearch as root$
and this is what logs look like all the time :
./bin/elasticsearch
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
[2019-08-29T11:43:27,917][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [dejancourt-VirtualBox] 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:163) ~[elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-7.3.1.jar:7.3.1]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.3.1.jar:7.3.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.3.1.jar:7.3.1]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:105) ~[elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:172) ~[elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:349) ~[elasticsearch-7.3.1.jar:7.3.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.3.1.jar:7.3.1]
... 6 more
and this, even after i've added ES_USER=elasticsearch and ES_GROUP=elasticsearch in /etc/default/elasticsearch
I do not have /etc/default/elasticsearch file.
lets remove it
make sure everything under /usr/share/elasticsearch is own by root:root
make sure dir persmission for /etc/elasticsearch is root:elasticsearch
make sure /usr/lib/systemd/system/elasticsearch.service is own by root:root
on above file execstart should look like this
ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet
I do not know what is going on here. I had this issue on early part when I was testing. that time I had issue with username/group and permission. and deleting everything and reinstalling was working. I had issue twice in past.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.