Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

elasticsearch systemd service failing

I have just switched to systemd on my linux 14.10 and now my elasticsearch service is not starting properly

elasticsearch.service             loaded failed failed  

a systemctl status gives me the following :

elasticsearch.service - Starts and stops a single elasticsearch instance on this system
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled)
   Active: failed (Result: exit-code) since Mon 2015-04-13 23:23:54 CEST; 4s ago
     Docs: http://www.elasticsearch.org
  Process: 1227 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -Des.default.config=$CONF_FILE -Des.default.path.home=$ES_HOME -Des.default.path.logs=$LOG_DIR -Des.default.path.data=$DATA_DIR -Des.default.path.work=$WORK_DIR -Des.default.path.conf=$CONF_DIR (code=exited, status=3)
 Main PID: 1227 (code=exited, status=3)

I have no experience in terms of managing services and I am pretty new to systemd so I don't see how I can resolve this.

Can someone point me in the right direction ? Thanks !

like image 351
Sébastien Avatar asked Apr 13 '15 21:04

Sébastien


2 Answers

Allright, i got it solved by removing the elasticsearch.service file, disabling the service and reinstalling this:

sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service
sudo /bin/systemctl start elasticsearch.service
like image 142
Sébastien Avatar answered Sep 28 '22 06:09

Sébastien


One approach to troubleshoot is to run the following command which kind of similar to what systemd executes. You will unearth problems pretty fast this way. For me it was java path.

sudo -u elasticsearch /usr/share/elasticsearch/bin/elasticsearch \ -Des.pidfile=/var/run/elasticsearch/elasticsearch.pid \ -Des.default.path.home=/usr/share/elasticsearch \ -Des.default.path.logs=/var/log/elasticsearch \ -Des.default.path.data=/var/lib/elasticsearch \ -Des.default.path.conf=/etc/elasticsearch

which: no java in (/usr/sbin:/usr/bin:/sbin:/bin) Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME

like image 39
Atul Soman Avatar answered Sep 28 '22 04:09

Atul Soman