ansible-roles/roles/elasticsearch/templates/elasticsearch.service.j2

50 lines
1.4 KiB
Django/Jinja

[Unit]
Description=Elasticsearch
Documentation=https://www.elastic.co
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
RuntimeDirectory=elasticsearch
PrivateTmp=true
Environment=ES_HOME={{ es_root_dir }}/app
Environment=ES_PATH_CONF={{ es_root_dir }}/etc
Environment=ES_TMPDIR={{ es_root_dir }}/tmp
Environment=PID_DIR=/run/elasticsearch
WorkingDirectory={{ es_root_dir }}/app
User={{ es_user }}
Group={{ es_user }}
ExecStart={{ es_root_dir }}/app/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid
# 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 {{ es_root_dir }}/log/
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
# Give some time for the process to stop
TimeoutStopSec=300
# 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