Just installed ElasticSearch 7.10 in a virtual machine this morning, and I noticed that when rebooting every time, ElasticSearch service was failed due to timeout.
Error Message
Screenshot:
Full log:
Warning: The unit file, source configuration file or drop-ins of elasticsearch.service changed on disk. Run 'systemctl daemon-reload' to reload units.
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)
Active: failed (Result: timeout) since Tue 2020-12-08 09:18:55 CST; 24min ago
Docs: https://www.elastic.co
Process: 889 ExecStart=/usr/share/elasticsearch/bin/systemd-entrypoint -p ${PID_DIR}/elasticsearch.pid --quiet (code=killed, signal=TERM)
Main PID: 889 (code=killed, signal=TERM)
Tasks: 0 (limit: 3570)
CGroup: /system.slice/elasticsearch.service
Dec 08 09:17:40 terrylin systemd[1]: Starting Elasticsearch...
Dec 08 09:18:55 terrylin systemd[1]: elasticsearch.service: Start operation timed out. Terminating.
Dec 08 09:18:55 terrylin systemd[1]: elasticsearch.service: Failed with result 'timeout'.
Dec 08 09:18:55 terrylin systemd[1]: Failed to start Elasticsearch.
Solution
Modify ElasticSearch configuation
Edit the configuation file of the ElasticSearch service.
$ vi /usr/lib/systemd/system/elasticsearch.service
TimeoutStartSec
configures the time to wait for start-up. The default is 90 seconds, increase this value to a proper value, in my case, I set it to 500.
Save the file and then reload systemd manager configuration.
Reload systemctl
$ systemctl daemon-reload
Check the timeout value for start-up.
$ systemctl show elasticsearch | grep ^Timeout
TimeoutStartUSec=8min 20s
TimeoutStopUSec=infinity
Now, problem is solved.
Comments
Why I only have TimeoutStopSec? I use ES version 7.3..freshly installed.. When I add TimeoutStartSec and reload daemon, the changes doesn’t applied.. Is it because the main systemd service overrides or something?
Thank you very much it worked for me. 🙂
OK but why does it take so long to start, can’t something be done about that?
Thank you so much. I was fighting this all weekend trying to get ES going on a Raspberry Pi.