Elasticsearch 1.6 reboot problem on ubuntu


#1

Hi Everyone,

Has anyone here installed the latest version of Elasticsearch on a Ubuntu? If so you might have encountered the elasticsearch PID_DIT issue when rebooting the Ubuntu server.

The file PID file is written to this directory: /var/run/elasticsearch but it's not actually there on Linux reboot because it gets deleted by ubuntu.This was not an issue in earlier versions (or at least not in 1.3.9). Is it possible to make elasticsearch write the pid-file to another location that doesn't get cleaned up by elasticsearch?

Thanks in advance,

Arno


(Magnus Bäck) #2

Why is it a problem that the PID file is deleted when the machine is rebooted?


(Rob) #3

Yes, I'm having the same problem. ES was running fine and I had to reboot the system - when I tried to restart ES I got this error:

touch: cannot touch ‘/var/run/elasticsearch/elasticsearch.pid’: No such file or directory


#4

@magnusbaeck The pid file being deleted is not the problem, it's the folder in which elasticsearch wants to store that is being deleted (/var/run/elasticsearch --> elasticsearch folder) so when it tries to insert it there on startup, it can't do it and simply refuses to start.

@Trident50 We found a solution. Open the elasticsearch file in /etc/init.d/ and change the PID_DIR from "/var/run/elasticsearch" to "/var/run" , now it will put the PID file there.

cheers

Arno


(Sri Harsha Kappala) #5

Elasticsearch is looking for a directory /var/run/elasticsearch which is not getting created by default with version 1.6

A quickfix could be just creating that directory by cd /var/run && sudo mkdir elasticsearch

Then restart elasticsearch by sudo service elasticsearch restart


(John Felipe Urrego Mejia) #6

But every time reboot i need do this
Other way pls?


(Sri Harsha Kappala) #7

Found that the solution which I have posted above won't work as the folder /var/run/elasticsearch itself will gets deleted on every restart. So as @arno mentioned in the above solution it is recommended to change the PID_DIR attribute. Just follow the below instructions.

  1. Go to /etc/init.d
  2. There you can see the elasticsearch binary. Open the file with your favorite editor with root privileges. sudo nano elasticsearch
  3. Change the value of PID_DIR attribute from /var/run/elasticsearch to /var/run
  4. Save the file and restart elasticsearch service. sudo service elasticsearch restart

You are good to go now!


(Gasol) #8

My solution is different. Just find the location of mkdir command and append $PID_DIR like following snippet

mkdir -p "$LOG_DIR" "$DATA_DIR" "$WORK_DIR" "$PID_DIR" && chown "$ES_USER":"$ES_GROUP" "$LOG_DIR" "$DATA_DIR" "$WORK_DIR"

(Hojin Jun) #9

Thanks @arno


(Diogenes Jesus) #10

Was this fixed on 1.7.0?


(system) #11