Linux

Elasticsearch: How to stop systemd service start operation from timing out

elasticsearch-error-feature

The Elastic Search Platform is a data store, search engine, and analytics solution. This article was necessitated out of the frustrations systemd threw at the writer when he tried to work on Elasticsearch. Hopefully, you will find the steps below useful if you are having a comparable situation as shown in the code box below. Also, please note that If the Elasticsearch service cannot be started within 90 seconds, it will be terminated (by default). This article will show you how to get up and running with your Elasticsearch service. Other helpful tutorials can be found here: Amazon Relational Database Service: How to install Amazon RDS using Terraform, how to install PostgreSQL on Ubuntu, and how to install and configure Prometheus for Monitoring on a Linux Server,

root@ubuntu:/home/rdgmh# sudo systemctl start elasticsearch
Job for elasticsearch.service failed because a timeout was exceeded.
See "systemctl status elasticsearch.service" and "journalctl -xe" for details.

Below are the steps on how to get your systemd service from failing while installing Elasticsearch on Linux, particularly Ubuntu 20.04. Here are some more guides you may want to read: How to deploy a React Application to AWS S3, and How to deploy a .NET application to AWS Elastic Beanstalk using AWS Tool Kit.

Step 1: Check the default timeout for starting operation.

 sudo systemctl show elasticsearch | grep ^Timeout
timeout1
default

Step2: Confirm the timeout by examining service runtime status information.

sudo systemctl status elasticsearch
failed
status

Step 3: Create a service drop-in configuration directory

sudo mkdir /etc/systemd/system/elasticsearch.service.d

Step 4: Define the “TimeoutStartSec” option to increase startup timeout.

echo -e "[Service]\nTimeoutStartSec=180" | sudo tee
servicetimeout

Step 5: Reload systemd manager configuration.

sudo systemctl daemon-reload

Step 6: Inspect altered timeout for start operation.

sudo systemctl show elasticsearch | grep ^Timeout
timeout2
timeout inspecti

Step7: Start the Elasticsearch service

sudo systemctl start elasticsearch

Step8: Examine the Elasticsearch service status.

 sudo systemctl status elasticsearch
elasticrunning
running

The service launch timeout was not prompted this time since it had been extended from 1 minute 30 seconds to 3 minutes.

Summary

We were able to resolve Elasticsearch service timing out because we extended the time from 1 minute 30 seconds to 3 minutes following the series of steps shown above and because of this, our Elasticsearch service was finally able to run without timing out.

Subscribe
Notify of
guest

1 Comment
Inline Feedbacks
View all comments
TheRobot
TheRobot
10 months ago

Still did not work for me. Went from 1min 15sec to 3min, then 5min, now 10 minutes. Granted I did install using ‘tar.gz’ files, instead of the .DEB package manager for Ubuntu. I have the “elasticservice.services” file. All starts fine interactively, if I start it as a ‘daemon.’ but I want to NOT rebuild it; and, instead, get the service working, where it starts as a service.

1
0
Would love your thoughts, please comment.x
()
x