I am configuring Elasticsearch 2.3.3 (yes, outdated) on CentOS 7.7. We were running it on CentOS 6 with InitV script. I followed this specification to create systemd
script and get inspired with the current Elastic sources.
vi /etc/systemd/system/elastic.service
[Unit]
Description=Elasticsearch
Wants=network-online.target
After=network-online.target
[Service]
Type=notify
RuntimeDirectory=elastics
WorkingDirectory=/opt/app/elastic/default/
ExecStart=/opt/app/elastic/default/bin/systemd-entrypoint -d -p ${PID_DIR}/elasticsearch.pid
StandardOutput=journal
StandardError=inherit
TimeoutStopSec=0
KillSignal=SIGTERM
KillMode=process
SendSIGKILL=no
SuccessExitStatus=143
When I start the service, it says that it failed but the process is started and running in fact:
-- Subject: Unit elastic.service has begun start-up
-- Defined-By: systemd
-- Unit elastic.service has begun starting up.
May 20 14:14:31 SE1 systemd[1]: Failed to start Elasticsearch.
-- Subject: Unit elastic.service has failed
-- Defined-By: systemd
-- Unit elastic.service has failed.
-- The result is failed.
May 20 14:14:31 SE1 systemd[1]: Unit elastic.service entered failed state.
May 20 14:14:31 SE1 systemd[1]: elastic.service failed.
May 20 14:14:31 SE1 polkitd[761]: Unregistered Authentication Agent for unix-process:20886:44881306 (system bus name :1.23878, object path /org/free
and
#cat /opt/data/elastic/work/elasticsearch.pid
20903
# ps lww 20903
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
0 606 20903 1 20 0 4692828 274460 futex_ Sl ? 0:09 /bin/java -Xms256m -Xmx1g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Djna.nosys=true -Des.path.home=/opt/app/elastic/default -cp /opt/app/elastic/default/lib/elasticsearch-2.3.3.jar:/opt/app/elastic/default/lib/* org.elasticsearch.bootstrap.Elasticsearch start -d -p /opt/data/elastic/work/elasticsearch.pid
How can I fix this issue? The stop does not work either. Thanks