I\'m trying to determine if the elasticsearch instance is running, but it doesn\'t appear to be:
ubuntu@ubuntu:~$ sudo service elasticsearch status
* elasti
The elasticsearch user cannot write the PID file because it has no permissions to create a file in /var/run/:
FileNotFoundException[/var/run/elasticsearch.pid (Keine Berechtigung)]
The fix: create the directory /var/run/elasticsearch/, change its ownership to elasticsearch:elasticsearch, and change the PID file location to this directory in the init script.
mkdir -p /var/run/elasticsearch
chown elasticsearch: /var/run/elasticsearch
sed -e 's|^PID_FILE=.*$|PID_FILE=/var/run/$NAME/$NAME.pid|g' -i /etc/init.d/elasticsearch
Once you get that far, here's the next error you might see:
ElasticsearchIllegalStateException[Failed to obtain node lock, is the following location writable?: [/var/lib/elasticsearch/elasticsearch]]
Again a resource does not have the correct permissions for the elasticsearch user.
chown -R elasticsearch: /var/lib/elasticsearch
Not done yet. Now you have to edit /etc/init.d/elasticsearch and remove this line:
test "$START_DAEMON" == true || exit 0
This line is utter garbage and is guaranteed to cause an exit.
Now it should finally start.