Starting Elasticsearch with systemd hangs

Hello,

I'm having trouble trying to start Elasticsearh (tar.gz installation) with Systemd.

This is the service's unit file. I copyied from Elastic's repo in Github and changed user, group and path variables. Other than that I already added the TimeoutStartSec=900 parameter, trying to solve this.

What happens is that systemctl start elasticsearch hangs... When I try to see the logs looks like it's stuck in:

OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.

And then it times out.

Unit file:

[Unit]
Description=Elasticsearch
Documentation=https://www.elastic.co
Wants=network-online.target
After=network-online.target

[Service]
Type=notify
TimeoutStartSec=900
RuntimeDirectory=elasticsearch
PrivateTmp=true
Environment=ES_HOME=/u/elastic/elasticsearch
Environment=ES_PATH_CONF=/u/elastic/elasticsearch/config
Environment=PID_DIR=/var/run/elasticsearch
Environment=ES_SD_NOTIFY=true

WorkingDirectory=/u/elastic/elasticsearch

User=elastic
Group=elastic

ExecStart=/u/elastic/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet

# StandardOutput is configured to redirect to journalctl since
# some error messages may be logged in standard output before
# elasticsearch logging system is initialized. Elasticsearch
# stores its logs in /var/log/elasticsearch and does not use
# journalctl by default. If you also want to enable journalctl
# logging, you can simply remove the "quiet" option from ExecStart.
StandardOutput=journal
StandardError=inherit

# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65535

# Specifies the maximum number of processes
LimitNPROC=4096

# Specifies the maximum size of virtual memory
LimitAS=infinity

# Specifies the maximum file size
LimitFSIZE=infinity

# Disable timeout logic and wait until process is stopped
TimeoutStopSec=0

# SIGTERM signal is used to stop the Java process
KillSignal=SIGTERM

# Send the signal only to the JVM rather than its control group
KillMode=process

# Java process is never killed
SendSIGKILL=no

# When a JVM receives a SIGTERM signal it exits with code 143
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

# Built for ${project.name}-${project.version} (${project.name})

Any clue? I suppose Systemd is waiting to be notified by the processe, but that doesn't happen somehow.

By the way, when I start manually it works.

Thank you!

Found this one. SHould be helpful for someone, but it didn't work for me.

In my case, qhen I removed the --quiet`` from the start line of the unit, I can see with journalctl -f -u elasticsearch` that Elasticsearch is up and running, quite fast...

But It doesn't seen to notify systemd. So my prompt keeps stuck.

So, I found the explanation for this... (by the way, I installed elasticsearch from tar.gz)

So, just changed Type to simple.

1 Like

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