I am setting up ElasticSearch on a Ubuntu VM and am running into some issues when settings it up to be a startup daemon. I have ES running just fine, I can run the server by going sudo /usr/share/elasticsearch/bin/elasticsearch. This runs the server and I can curl localhost:9200 just fine.

I then used this guide to set up a startup service. The problem is after doing everything they said:

sudo update-rc.d elasticsearch defaults 95 10

sudo /etc/init.d/elasticsearch start

I can see the service appears to be running just fine by running sudo /etc/init.d/elasticsearch status (or just service elasticsearch <start|stop|restart> works as well), however a top or another curl localhost:9200 shows the server as not being spun up.

Furthermore, I can see the output to the start command shows everything ran fine without any error.. The start-stop-daemon command returned 0 (which is success) as if nothing went wrong...

I am fairly new to this, so I am not sure what to try next or where to look for a bad configuration. Any one have any ideas? Thanks


Your Elasticsearch service init script doesn't print any error information on console or log file and shows [Ok], doesn't it?

You have to run Elaticsearch manually with the same user and same parameters as what the init script does to check what's going wrong. The error message will be printed on console.

The correct command to run Elasticsearch in init script should be:

sudo -u elasticsearch /usr/share/elasticsearch/bin/elasticsearch -d -p /var/run/elasticsearch.pid --default.config=/etc/elasticsearch/elasticsearch.yml --default.path.home=/usr/share/elasticsearch --default.path.logs=/var/log/elasticsearch --default.path.data=/var/lib/elasticsearch --default.path.work=/tmp/elasticsearch --default.path.conf=/etc/elasticsearch

Just try to add a line into /etc/init.d/elasticsearch to print out the above command:

# Start Daemon
log_daemon_msg "sudo -u $ES_USER $DAEMON $DAEMON_OPTS"    # <-- Add this line
start-stop-daemon --start -b --user "$ES_USER" -c "$ES_USER" --pidfile "$PID_FILE" --exec $DAEMON -- $DAEMON_OPTS
log_end_msg $?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.