ElasticSearch Service Startup Issue

Hey everyone,

I hope you're doing well. I've been working on setting up an Elasticsearch service using a systemd service file, but I'm encountering an issue when trying to start the application. I'm hoping someone here might be able to help me troubleshoot the problem.

Here's the systemd service file I've written:

[Unit]
Description=ElasticSearch Service
After=network.target

[Service]
ExecStart=/elk/tools/elasticsearch-7.4.2/bin/elasticsearch
PIDFile=/elk/tools/elasticsearch-7.4.2/elasticsearch.pid
User=elk
Type=simple
Restart=always

[Install]
WantedBy=default.target

However, when I attempt to start the application, it fails to start, and I receive the following error message:

Aug 23 21:13:07 local bash[22652]: OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Aug 23 21:13:08 local bash[22652]: Exception in thread "main" java.lang.IllegalArgumentException: /elk/tools/elasticsearch-7.4.2/bin/elasticsearch exists but is not a directory
Aug 23 21:13:08 local bash[22652]:         at org.elasticsearch.common.PidFile.create(PidFile.java:62)
Aug 23 21:13:08 local bash[22652]:         at org.elasticsearch.common.PidFile.create(PidFile.java:55)
Aug 23 21:13:08 local bash[22652]:         at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:324)
Aug 23 21:13:08 local bash[22652]:         at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159)
Aug 23 21:13:08 local bash[22652]:         at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150)
Aug 23 21:13:08 local bash[22652]:         at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
Aug 23 21:13:08 local bash[22652]:         at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:125)
Aug 23 21:13:08 local bash[22652]:         at org.elasticsearch.cli.Command.main(Command.java:90)
Aug 23 21:13:08 local bash[22652]:         at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115)
Aug 23 21:13:08 local bash[22652]:         at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92)
Aug 23 21:13:08 local bash[22652]: Refer to the log for complete error details.
Aug 23 21:13:08 local systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Aug 23 21:13:08 local systemd[1]: elasticsearch.service: Failed with result 'exit-code'

It seems like the issue is related to the path to the Elasticsearch executable and the PID file. I've verified that the paths are correct, but I'm still encountering this error.

Has anyone faced a similar issue before or can provide any insights into what might be causing this problem? I'd greatly appreciate any assistance or suggestions you can offer

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.